Home > Web Front-end > HTML Tutorial > How do things in a div appear outside [Simplified version]_html/css_WEB-ITnose

How do things in a div appear outside [Simplified version]_html/css_WEB-ITnose

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

My description of the last question was too verbose, so I reopened 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


The things inside b were actually displayed outside, and the key is my d It floats to the right, and it actually pushes the items in b to the bottom. I don't quite understand what's going on.



Reply to discussion (solution)

Just float the b element to the left

Just float the b element to the left


I figured it out, it’s true, I just need to remove the margin-left, because float:right is already pasted on the rightmost side
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