Centering in CSS, when the object is larger than the viewport -
i'm trying jquery carousel centered on screen, when clipping area wider viewport. give element negative left margin -- how can specify this? clipping area fixed width of course viewport area variable.
here's best solution i've been able find uses wrapping element around your-fixed-width content, -50% margin on content itself. off top of head, should enough started. here's code snippet:
div.wrapper { position: absolute; left: 50%; } .content { position: relative; margin-left: -50%; } <div class="wrapper"> <div class="content">jquery biz-nass here</div> </div>
of course, assumes div here direct descendant of body
tag, , browser specifies body
have width of 100% , no margin or padding.
Comments
Post a Comment