2016-07-16 9 views
-1

どのようにスペースを削減する要素ですか?

HTMLの要素間の距離を減らす方法を教えてもらえますか?私は、例えば、 "Supporting Milestones"というテキストを表の枠の上に書いて、 "2017年末までにデータセンター上のものを" ul要素の上にシャットダウンしたいのですか?

+1

にTE要素のマージンとパディングを変更 –

答えて

1

見出し要素のCSSマージン(<h1><h2>など)には、デフォルトの上端余白と下端余白があります。

http://www.w3schools.com/css/css_margin.asp

あなたはそれらの要素のためのあなたのCSSでこれを変更することができます。

0

負の値を使用してCSSマージンを使用できます。あなたはCSSを使用することができます

#header3 { 
 
    margin: 0 0 0 0; 
 
} 
 
#header4 { 
 
    margin: 0 0 0 0; 
 
} 
 
#header5 { 
 
    margin: 0 0 0 0; 
 
} 
 
#header6 { 
 
    margin-top:-20px; 
 
}
<!DOCTYPE html> 
 
<html> 
 
<head></head> 
 
<body> 
 
<p>In this example Heading 1 and Heading 2 have the default margin values.</p> 
 
<h1 id="header1">Heading 1</h1> 
 
<h2 id="header2">Heading 2</h2> 
 
<p>In this one Heading 3 and Heading 4 have the margin values set to zero.</p> 
 
<h1 id="header3">Heading 3</h1> 
 
<h2 id="header4">Heading 4</h2> 
 
<p>In this one Heading 6's top margin value is set to -20px .</p> 
 
<h1 id="header5">Heading 5</h1> 
 
<h2 id="header6">Heading 6</h2> 
 
</body> 
 
</html>

関連する問題