The application of CSS position attribute in div layer

Source: Internet
Author: User

Positioning, the parent div set position:relative, the child Div Position:absolute will be relative to the parent div for absolute positioning, next for you to introduce the CSS position attributes in the div layer application

Originally only understand position:relative is relative positioning, position:absolute is absolute positioning;

You often see a text description of a semi-transparent background underneath a picture carousel. I now have to do such an effect, because it is not a carousel, so did not go to find plug-ins, want to write their own.

Semitransparent backgrounds can set properties Background:rgba (0, 0, 0, 0.15);

Positioning, the parent div set position:relative, the child Div Position:absolute will be relative to the parent div for absolute positioning. That would be convenient.

Copy Code code as follows:
. Banner{margin:20px;height:204px;position:relative;overflow:hidden}
. Banner. Content{color: #FFF; Font-size:24px;line-height:30px;font-weight:800;background:rgba (0, 0, 0, 0.15); position:absolute;left:0;right:0;bottom:0;}


Effect:

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.