Making a div that sits outside the content area but doesn't cause the horizontal scroll bar to appear when browser window is shrunk

前端 未结 3 1832
长情又很酷
长情又很酷 2021-01-01 07:53

Let\'s say you have a website where the body\'s background color is red and a content area with a white background that is 1,000 pixels wide. Now let\'s say you want a drop

相关标签:
3条回答
  • 2021-01-01 08:16
    
    <html>
    <body style="background:url(bg.jpg) red repeat-y center top">
        <div align="center" width="100%" background="bg.jpg">
            <div style="width:870px;align:center;background:silver" align="center">test</div>
        </div>
    <body>
    </html>
    
    

    The image below is small so you need to look closely :)

    Sample Image

    0 讨论(0)
  • 2021-01-01 08:17

    Can the content area be 904px wide (1000-47-47) ? :P Afraid I'm going to need some code to help describe what you're talking about...

    0 讨论(0)
  • 2021-01-01 08:39

    See this answer to my accidental duplicate: Technique for using a wide background div without affecting body width. Similar to @Leigh's, but possibly cleaner.

    0 讨论(0)
提交回复
热议问题