How can I resolve this border/background image clash?
-
I have a <div> element with a border and background image. I've positioned the background image to the top right to give a page curl effect. The problem is that the border appears adjacent to the background image instead of hiding it so I get both the top right background image and top right border being shown. How can I get it so that I can still keep the border but have the background image cover what's in the top right hand corner? Thanks. Here's the css: #main { padding: 20px 20px 0 20px; width: 650px; float:right; margin-top: 30px; margin-right: 125px; border: solid 1px #c3c0be; background: url('img/page_curl.png') no-repeat top right #fef1e9; }
-
Answer:
You can't do it with just one div since, as you said, the background will always appear next to the border. One way of doing it would be something like this: <style> #container { position:relative; width: 650px; margin-top: 30px; margin-right: 125px; } #content { padding: 20px 20px 0 20px; border: solid 1px #c3c0be; } #pageCurl { position:absolute; top:0; right:0; background: url('img/page_curl.png') no-repeat top right #fef1e9; width:100px; /* replace with actual size of your image */ height:100px; } </style> <div id="container"> <div id="pageCurl"></div> <div id="content">your content</div> </div>
Nick C at Yahoo! Answers Visit the source
Other answers
You can't do it with just one div since, as you said, the background will always appear next to the border. One way of doing it would be something like this: <style> #container { position:relative; width: 650px; margin-top: 30px; margin-right: 125px; } #content { padding: 20px 20px 0 20px; border: solid 1px #c3c0be; } #pageCurl { position:absolute; top:0; right:0; background: url('img/page_curl.png') no-repeat top right #fef1e9; width:100px; /* replace with actual size of your image */ height:100px; } </style> <div id="container"> <div id="pageCurl"></div> <div id="content">your content</div> </div>
the dahu hunter
Related Q & A:
- How can I have a border around the center part of my Myspace profile, just the bit that is white?Best solution by Yahoo! Answers
- How can I put an image for my background on Myspace?Best solution by Yahoo! Answers
- How can I save my computer desktop's background as an image/pic?Best solution by Yahoo! Answers
- How can I change my MSN background to color again?Best solution by answers.microsoft.com
- How do I add a custom background image to my Tumblr?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.