Div + CSS float

Source: Internet
Author: User

Test.html:

 

<HTML> <br/> <pead> <br/> <LINK rel = "stylesheet" type = "text/CSS" Media = "screen" href = "c.css" mce_href = "c.css"/> <br/> </pead> <br/> <body> <br/> <Div id = "footer2"> <br/> This Is A footer2 div <br/> </div> <br/> <p id = "p1"> <br/> This Is A P1 P <br/> </P> <br /> <p id = "p2"> <br/> This is a P2 P <br/> </P> <br/> <Div id = "footer3"> <br/> This Is A footer3 Div <br/> </div> <br/> </body> <br/> </ptml>

C.css:

Div # footer2 {<br/> float: Left; <br/> background-color: # FAF; <br/> width: 200px; <br/> Height: 80px; <br/> margin: 10px; <br/>}< br/> # P1 {<br/> float: Right; <br/> background-color: # AFA; <br/> width: 200px; <br/> Height: 80px; <br/> margin: 2px; <br/>}< br/> # P2 {<br/> float: Right; <br/> background-color: # AFA; <br/> width: 200px; <br/> Height: 80px; <br/> margin: 2px; <br/>}< br/> # footer3 {<br/> float: right; <br/> Background: # AFE; <br/> width: 200px; <br/> Height: 80px; <br/> margin: 2px; <br/>}

 

1.

There are two <p> elements in the middle, so the problem arises. If margin is not set in CSS, it will look different in ff.

The height of P varies.

Add a margin, even if the limit is 0.

 

In 2.css, float and clear cannot be used together. Using clear together does not work.

So now I still don't know how to let footer2 clear both and let it float to the right. What should I do?

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.