2

I am having trouble with a container div, border-radius, and overflow.

(For anyone on hubspot, the following question is how to move the footer content outside of the container div)

NOTE: I am stuck inside a CMS template and cannot change the format or content of the HTML. It must rely solely on CSS

The following is the general layout of the website

    <div id="container">
       <div id="header">...</div>
       <div id="content">...</div>
       <div id="footer">...</div>
    </div>

the css that is applied is the following:

#container{
   -moz-border-radius: 15px !important;
   -webkit-border-radius: 15px !important;
   -khtml-border-radius: 15px !important;
   border-radius: 15px !important;
   overflow: hidden;
}

if I change the overflow:hidden to overflow:visible the border disappears (at least on Chrome). Does anyone know why this happens and whether there is a way around it?

1
  • I know why this happens. A solution without overflow:hidden eludes me though Commented Dec 25, 2012 at 3:54

2 Answers 2

1

If your asking for why this happens the answer is simple.

Borders in most browsers work in such a manner. Discover a bounding rectangle. Draw the required radius around the bounding rectangle.

The problem is the browsers draw the border on the edge of the bounding rectangle .

So theoretically elements can break through the bounds of the rectangle when they are rounded.

This is the overflow. So if overflow:visible the edges might not be clean.

Why does overflow:hidden fix this

Well its simple overflow:hidden just hides anything outside the bounds of a bounding rectangle. Hence and therefore this would clean up your border

Sign up to request clarification or add additional context in comments.

Comments

0

i have been using radius on buttons, and sometimes the !important; crashes the ruleset when used on border radius, then removing !important causes the ruleset to work again...

(found out while tweaking css of some websites)

1 Comment

He never said his ruleset was crashed? The border works but it just has an overflow problem

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.