Css div absolute positioning and fixed positioning instance

Source: Internet
Author: User

It is very important to locate the div block in css. If you are not familiar with div positioning, it will be messy to write your css, next, let's take a look at the absolute positioning and fixed positioning examples of css div. This will be helpful to you.

FirstFixed css div positioningInstance

<Style type = "text/css">
P. one
{
Position: fixed;
Left: 5px;
Top: 5px;
}
P. two
{
Position: fixed;
Top: 30px;
Right: 5px;
}
</Style>
</Head>
<Body>

<P class = "one"> some text. </P>
<P class = "two"> More text. </P>


SecondAbsolute css div positioning

<Style type = "text/css">
H2.pos _ abs
{
Position: absolute;
Left: 100px;
Top: 150px
}
</Style>

<H2 class = "pos_abs"> This is an absolute positioning Title. <P> with absolute positioning, elements can be placed anywhere on the page. The title below is PX to the left of the page and PX to the top of the page. </P>

 

Related Article

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.