negative padding

For technical support for all editions of CSE HTML Validator. Includes bug reports.

negative padding

Postby roedygr » Mon Jan 04, 2010 7:30 pm

padding: -10px 0px 0px 0px; /* inner t r b l */

This validates ok with HTMLValidator and with TopStyle. However it fails W3C CSS validator.

The book I learned CSS from told me it was OK.

It crashes Amaya browser.

The spec at http://www.w3.org/TR/CSS21/box.html#propdef-padding says nothing one way or the other.

What's the scoop?
User avatar
roedygr
Rank V - Professional
Rank V - Professional
 
Posts: 242
Joined: Fri Feb 17, 2006 6:22 am
Location: Victoria BC Canada

Re: negative padding

Postby MikeGale » Mon Jan 04, 2010 9:02 pm

Hi,

I'm not an expert on this.

It did interest me though, so I searched and found two web pages that talk about only non-negative padding being allowed.

See:

http://archivist.incutio.com/viewlist/css-discuss/42541

http://www.w3.org/TR/CSS21/box.html

The latter (which is W3C about CSS 2.1) says:

Unlike margin properties, values for padding values cannot be negative. Like margin properties, percentage values for padding properties refer to the width of the generated box's containing block.


(I know that negative margins are used by some "stylists" and are officially allowed.)

There's presumably some design discussion about this in the W3C archives. It might be worth a warning in CSE.
User avatar
MikeGale
Rank VI - Professional
Rank VI - Professional
 
Posts: 604
Joined: Mon Dec 13, 2004 2:50 pm
Location: Tannhauser Gate

Re: negative padding

Postby roedygr » Mon Jan 04, 2010 9:43 pm

Aha! The book I read on CSS probably told me that negative margins were ok, and I just presumed that negative paddings were ok too.

So CSEvalidator and TopStyle are improperly letting negative paddings through.
User avatar
roedygr
Rank V - Professional
Rank V - Professional
 
Posts: 242
Joined: Fri Feb 17, 2006 6:22 am
Location: Victoria BC Canada

Re: negative padding

Postby Lou » Mon Jan 04, 2010 11:30 pm

Code: Select all
.oddone     {position: absolute;
             top: -250px; left: -250px;
            }


The above CSS validate with http://jigsaw.w3.org/css-validator as part of a URL or direct input.
User avatar
Lou
Rank IV - Intermediate
Rank IV - Intermediate
 
Posts: 180
Joined: Fri Jul 29, 2005 5:55 pm
Location: MD

Re: negative padding

Postby Albert Wiersch » Tue Jan 05, 2010 1:29 am

Yes, padding values should not be negative. This has already been addressed/fixed in v10. I'm sorry for the trouble.

I plan to have a public BETA out for v10 sometime this month.

http://www.w3.org/TR/css3-box/#the-padding

Sets the thickness of the padding area. The value may not be negative.
Image
Albert Wiersch
User avatar
Albert Wiersch
Site Admin
Site Admin
 
Posts: 2361
Joined: Sat Dec 11, 2004 10:23 am
Location: Near Dallas, TX


Return to CSE Tech Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron