CSS--position

Source: Internet
Author: User

<title>Css–position</title> Css–positiontable of Contents
    • Static
    • Fixed
    • Absolute
    • Relative
Static

Default positioning mode top and left do not work

Fixed

Move without scrolling with the page is generally a navigational element

Absolute

After setting the current position to absolute, then his position is relative to his father.

  float: left; left: 50px;            Relative to the father is 50px  top: 50px;

Similar to this

<div id="Id1">  <div id="Id2">    # Absolute  </div></div>
Relative

The opposite is where he was originally supposed to be, such as:

 #div1  {width     : 800px;    height : 800px;    background : Green; position : absolute;}  #div2     {width : 200px;    height : 200px;    background : Red;    float : Left;    left : 50px;    top : 50px; position : relative;} 
<divid="Div1">  <divid="Div2"></  Div></div>

Where he was supposed to be.

Now the position is 50px from the left .

CSS--position

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.