標籤:blog body code 物理 flow doctype pre display har
visibility
-1.設定是否顯示對象。與display:none不同,此屬性為隱藏的對象保留其佔據的物理空間
-2.如果希望對象為可視,其父物件也必須為可視的。
-3.屬性值:
-visible:設定對象可視
-hidden:設定對象隱藏
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title></title> <style> .content{ width: 100px; height: 100px; background-color: aqua; visibility: visible; } .container{ width: 200px; height: 200px; background-color: bisque; visibility: hidden; } </style></head><body> <div class="container"> <div class="content"> hello </div> </div></body></html>
overflow
-1.複合屬性,設定對象處理溢出內容的方式。效果等同於overflow-x + overflow-y
-2.如果希望對象為可視,其父物件必須也為可視
-3.屬性值:
visible:對溢出內容不處理,內容可能會超出容器(預設)
hidden:隱藏溢出容器的內容且不會出現捲軸
scroll:隱藏溢出容器的內容,溢出的內容將會以捲軸的方式呈現
auto:當內容沒有溢出容器時不出現捲軸,當內容出現溢出時,出現捲軸,按需出現捲軸。
此為body對象和textarea的預設值。
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title></title> <style> .content{ width: 200px; height: 100px; background-color: pink; overflow: auto; } </style></head><body> <div class="content"> 大家好 </div></body></html>
css的isibility和overflow