I know the new CSS + HTML super-cool center strategy

Source: Internet
Author: User

This method can even solve the problem that the IMG content is centered

Routines: The outermost div width is the width of the center content (usually 1170px), and it is centered (Margin:auto)

The div width in the inner layer is full screen (usually 1920px;) margin-left:-368px the value equals (1170-1920)/2 = 375px, but the actual combat time will also be biased. So it doesn't have to be a death rule.

The principle is not clear at the moment. Here's how:

Html:

<Divclass= "My-slider-li-imgdiv">  <Divclass= "My-slider-li-imgdiv-inner">    <imgsrc= "Http://images.weicantimes.com/banner-1.jpg"alt= "More intelligent food and beverage information Management system, customer return, efficient promotion, easy management, intelligent operation" />  </Div></Div>

Css:

. My-slider-li-imgdiv {         width:1170px; margin: auto;    } . My-slider-li-imgdiv-inner {        width:1920px;    margin-left: -368px;    }

I know the new CSS + HTML super-cool center strategy

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.