Heim >Web-Frontend >HTML-Tutorial >width:100%,也不能让DIV占满整个屏幕_html/css_WEB-ITnose

width:100%,也不能让DIV占满整个屏幕_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:41:302009Durchsuche

 有上,中,下3个div,如何让其占满屏幕?

 <div style="width:100%;background:#ffffff;height:100px;border:0;padding:0;margin:0;text-decoration:none;"></div> <div style="width:100%;background:red;height:100px;border:0;padding:0;margin:0;text-decoration:none;"></div>  <div style="width:100%;background:yellow;height:100px;border:0;padding:0;margin:0;text-decoration:none;"></div>


回复讨论(解决方案)

html,body{margin:0;pading:0;}

div的容器是否是占了页面的100%?用 body 的padding:0看看先。你的页面布局是怎么样的,最好发个图上来。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn