No thank you, I'm looking for the html/css solution. I should also add that this is xhtml 1.0 transitional.
Main Topics
Browse All TopicsI'm trying to make a box using all divs and css that has the top left and right corners rounded. The trick here that I want to be have the box stretch to the width of the the parent element. Like a table with width="100%". A number of things aren't happening correctly. The first row is way too tall, it's only supposed to be 6px. It doesn't float correctly, TopFill is too wide, but if I take width: 100% out, it doesn't work right either. See the code below:
<div id="MainFrame" style="width: 800px">
<div id="LeftColumn" style="width: 400px;">
<div id="Box">
<div id="TopRow" style="height: 6px;">
<div id="TopLeftCorner" style="float: left; width: 6px; height: 6px; background-image: url(http://skinnedclient.w
<div id="TopFill" style="float: left; width: 100%;background-color: #4f75d8; height: 6px;"></div>
<div id="TopRightCorner" style="clear: right; width: 6px; height: 6px; background-image: url(http://skinnedclient.w
</div>
<div id="Header" style="clear: both;background-color: #4f75d8">
header Title
</div>
<div id="Body">
body
</div>
</div>
</div>
</div>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
A couple of things:
There is a small problem with IE that for some reason even if you make the div say 3 px in height it will default to the size of the text line. In order to solve this you must say that line-height: 6px;.
Ok, the next thing. In this instance you have specified that the width of your left column is 400px, there is no need to make anything 100% of the width because you already know the width, so hard code it. Another issue is that the middle column the TopRow fill is trying to be 100% of its containing element, which will explain why the two left and right corners are acting strange.
I have altered the code slightly and get a different result. Hope this helps.
<div id="MainFrame" style="width: 800px">
<div id="LeftColumn" style="width: 400px;">
<div id="Box">
<div id="TopRow" style="height: 6px; line-height: 6px;">
<div id="TopLeftCorner" style="float: left; width: 6px; line-height: 6px; height: 6px; background-image: url(http://skinnedclient.w
<div id="TopFill" style="float: left; width: 388px;background-color: #4f75d8; height: 6px; line-height: 6px;"></div>
<div id="TopRightCorner" style="float: right; width: 6px; line-height: 6px;height: 6px; background-image: url(http://skinnedclient.w
</div>
<div id="Header" style="clear: both;background-color: #4f75d8">
header Title
</div>
<div id="Body">
body
</div>
</div>
</div>
</div>
The code I posted, while a javascript file, produces VALID html and can be used along side your existing CSS. It should also validate under xhtml just fine. It will also allow you to reuse the code, and may eliminate any issues you may have. It also doesn't use images, rather PURE css and html. Your code uses images, so the .js file is as valid as "html/css solution" as your code is.
Not trying to sound preachy, but people write a lot of really good code so you don't have to.
Well a full CSS solution to the problem without resorting to using javascript would be this:
<div id="MainFrame" style="width: 800px">
<div id="LeftColumn" style="width: 400px;">
<div id="Box">
<div id="TopRow" style="height: 6px; line-height: 6px;background-color: #4f75d8">
<div id="TopLeftCorner" style="float: left; width: 6px; line-height: 6px; height: 6px; background-image: url(http://skinnedclient.w
<div id="TopRightCorner" style="float: right; width: 6px; line-height: 6px;height: 6px; background-image: url(http://skinnedclient.w
</div>
<div id="Header" style="clear: both;background-color: #4f75d8">
header Title
</div>
<div id="Body">
body
</div>
</div>
</div>
</div>
This should mean that you can make the box any size you like.
Business Accounts
Answer for Membership
by: MorcalavinPosted on 2006-11-09 at 08:30:47ID: 17907276
Just use http://www.curvycorners.ne t/ to make a box with rounded corners. You'll save tons of time since everything is already done for you.