The usage of float in CSS is described in detail

Source: Internet
Author: User
about float very early contact, below with a small demo to talk about.

1: In the page layout, assume that there are two P, the demand is two p in the same row; one of the solutions is to use floating,

eg

<li style= "border-top:1px #CCCCCC dashed;border-bottom:1px #CCCCCC dashed;" >                    <p class= "g-position_a" > Job profiles </p>                    <p class= "G-position_b" >                        <dl class= " g-position_list fl ">                            <dd> Job Title: PHP Engineer </dd>                            <dd> working experience: 1-3 years </dd>                            <dd> Number of recruits: 10 </dd>                            <dd> Minimum Education: Unlimited </dd>                        </dl>                        <dl class= "G-position_list fr" >                            <dd> Monthly Salary: 3000-5000 yuan (tax calculation) </dd>                            <dd> Age: Unlimited </dd>                        </dl>                    </p> </li><p class= "box" style= "width:300px;height:300px;></p>

2: The above code because Li's two P floating around (out of the document flow), Li will not have a "page performance" height, so li up and down the border line will be coincident,

Li's subsequent class called Box's p will come up;

The solution at this point is to add a p that removes the float after its two floating sub p, when Li is re-represented in the page because of the height of the "inner element Open";

eg

<li>                    <p class= "g-position_a" > Job profiles </p>                    <p class= "G-position_b" >                        <dl class= " G-position_list ">                            <dd> Job Title: PHP Engineer </dd>                            <dd> working experience: 1-3 years </dd>                            <dd> Number of recruits: 10 </dd>                            <dd> Minimum Education: Unlimited </dd>                        </dl>                        <dl class= "G-position_list" >                            <dd> Monthly Salary: 3000-5000 yuan (tax calculation) </dd>                            <dd> Age: Unlimited </dd>                        </dl>                    </p>                    <p class= "Clearfix" ></p>             </li>


Above this cliché CSS in the use of float is a small part of the whole content to share to everyone, I hope to give you a reference, but also hope that we support topic.alibabacloud.com.

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.