The default bug view has changed. See this FAQ.

clip should not clip border and background (including padding)




18 years ago
17 years ago


(Reporter: dbaron, Assigned: troy)




Firefox Tracking Flags

(Not tracked)


(Whiteboard: CSS2 spec clarification needed (?))


(1 attachment)



18 years ago
My interpretation of the CSS2 spec is that clip should not clip the border and
background of an element, only its content.  Currently, you clip border and
background.  However, this is what legacy browsers do, I think, so there is a
chance CSS could be changed (although I would oppose it - it would make the
behavior of overflow: hidden very strange - it would hide the borders too,
assuming that the 'generated box' to which an element is clipped is really the
content edge and not the border edge!).  (The only legacy browser to which I
have access now is actually WinIE4, which only clips positioned elements but
does exhibit the behavior I describe - I don't have NN4 or IE5, or anything non-
Win.)  You should be sure to check with the authors of CSS before fixing this

See the test case to be attached.

EXPECTED: You should see a 300px*300px div with a medium solid green border,
with a patch of text in the middle that has had its edges clipped off.

ACTUAL: The background and border are being clipped along with the content.

TESTED IN: viewer, Win95, 1999-08-09-09-M9   (bug marked All/All since XP code)

Comment 1

18 years ago
Created attachment 1193 [details]
test case for clipping of backgrounds and borders


18 years ago
Target Milestone: M11

Comment 2

18 years ago
David, in light of the discussion in bug #10915, do we want to change this to
"clip should not clip border" instead?

Comment 3

18 years ago
No.  Why would you say that?

If you have:

p {
  background: yellow;
  padding: 20px;
  border: medium solid red;
  height: 100px;
  width: 100px;
  overflow: hidden;
  clip: rect(30px, 50px, 50px, 30px); /*new version of rect(): see bug 11565*/

Then you should see a 140px*140px yellow box with a red border all the way
around, with a little bit of text in the 20px*20px area just to the upper-left
of the center (if I did that right).  At least the way CSS2 is written now...

Comment 4

18 years ago
I misread the title of the bug. I thought it mentioned the border and "padding",
but I see it says "background". In reading the bug report again, you don't
actually mention padding in the bug report. Maybe you should, and that way it's
very clear what you expect. Otherwise, I might misread it again. :-)


18 years ago
Summary: clip should not clip border and background → clip should not clip border and background (including padding)

Comment 5

18 years ago
Retitled bug to indicate that THE PADDING IS COVERED BY THE BACKGROUND.  (You
won't miss that, will you? :-)

The point is that clip shouldn't clip border and background even if the clip
rect is set small.  (I think you know that now, but it can't hurt to say it
again.  Or can it?)

Comment 6

18 years ago
I certainly agree with you that clip shouldn't clip border and background even
if the clip rect is set small. And no it didn't hurt to repeat it again.

However, no you've asserted that the padding is covered by the background. Yes,
that's true, but the point I was trying to make (and not doing a very good job
of it :-) is that an open issue was whether the clip rect is relative to the
padding edge or the content edge.

I thought we were thinking padding edge and that should be specified in the bug
as well


18 years ago
Depends on: 11565
Summary: clip should not clip border and background (including padding) → {css2} clip should not clip border and background (including padding)
[Hi again. Just installing another radar...]


18 years ago
Target Milestone: M11 → M13


18 years ago
QA Contact: petersen → chrisd


18 years ago
Whiteboard: CSS2 spec clarification needed (?)
Keywords: css2
Migrating from {css2} to css2 keyword. The {css1}, {css2}, {css3} and {css-moz}
radars should now be considered deprecated in favour of keywords.
I am *really* sorry about the spam...


17 years ago
Summary: {css2} clip should not clip border and background (including padding) → clip should not clip border and background (including padding)


17 years ago
Target Milestone: M15 → M17

Comment 9

17 years ago
The upcoming errata separates out 'clip' from 'overflow' 'hidden'. 'clip' is 
border-edge relative and applies to the entire element including border and 
background. Clipping because of 'overflow' set to 'hidden' is content area 
relative and does not clip border and background

I changed our imnplementation to be in accordance with the new rules
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 10

17 years ago
Windows: 2000-07-12-09-M17
NOT Fixed for Linux on build 2000-07-13-08-M17.
I do not see green border on Linux.

Comment 11

17 years ago
Verified fixed on Linux with 09/18 build
You need to log in before you can comment on or make changes to this bug.