div里东西怎么显示到外面去了【简化版】_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 12:05:44
Original
1089 people have browsed it

上个问题我自己描述的太罗嗦了,重开一个= =

<html>   <head>      <title>hehe</title>      <style type="text/css">	     div#a		 {			 background-color:#F00;			 width:50%;			 height:500px;		 }			          div#c         {            background-color:#000;            width:30%;            height:40%;         }          div#b         { 		    background-color:#0C0;            width:30%;            height:60%;         }		 		 div#d		 {			float:right;			background-color:#60C;			margin-left:30%;			width:70%;            height:100%;		 }      </style>   </head>   <body>      <div id="a">         <div id="d"></div>         <div id="b">hehe</div>         <div id="c"></div>      </div>   </body></html>
Copy after login


b里面的东西居然显示到了外面,而且关键是我的d是float到右边的,居然会把b里的东西撑到最下面,不是太理解是什么情况。



回复讨论(解决方案)

b元素左浮动就好

b元素左浮动就好


搞明白了,其实没错,只是要把margin-left去掉,因为float:right已经贴在最右边了
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!