CSSルール 'clear:both'は何をしますか?
What Does Css Ruleclear
clear属性は、フローティング要素のどちら側をフロートさせないかを指定するために使用され、フローティングオブジェクトに対する要素の位置を設定または返します。 「クリア:両方」は、左側と右側で許可されていないフローティング要素を設定するために使用されます。
元の住所: CSSルール 'clear:both'は何をしますか?
指定された要素に関連する要素を左右にフロートさせる必要がなく、下にのみ表示される場合は、この「clear:both」ルールを使用できます。このルールは、他の要素が左右のスペースを占有しないことも示しています。
文法:
clear:both
例:
div { width:100px height:100px background-color:green color:white font-weight:bold font-size:25px text-align:center float: left padding:15px } p.demo { clear: both } h1 { color:green text-align:center } Hello
This is a test text! This is a test text! This is a test text! This is a test text! This is a test text! This is a test text!
This is a test text!
効果画像:
ブラウザのサポート:
●GoogleChrome
●InternetExplorer
●Firefox
●Opera
●Safari
推奨読書: