Tantek hack or box-sizing

N

Nico Schuyt

Which method is to be preferred to prevent that padding is added to the box
size:
The Tantek hack or adding -moz-box-sizing: border-box; box-sizing:
border-box; to the properties of the div?

Nico
 
S

spaghetti

Nico Schuyt said:
Which method is to be preferred to prevent that padding is added to the box
size:
The Tantek hack or adding -moz-box-sizing: border-box; box-sizing:
border-box; to the properties of the div?

I seldom find the need to use any hacks. Anywhere I have a fixed size I
simply don't use padding, I just disregard it as an option. But that's
because usually I have a few "container" <div>s that are fixed size without
padding. All the block elements inside these containers naturally stretch to
fill the full width, so I add margins to these, or I can add padding to the
sub elements as well, because they don't have a size explicitly set.

Basically I use alot of margins to place my boxes around inside padding-less
"fixed size" block elements.

But don't trust me, I have a strange negative-margin fetish. Which is
probably just as bad as using hacks, I guess.
 
I

Isofarro

Nico said:
Which method is to be preferred to prevent that padding is added to the
box size:
The Tantek hack or adding -moz-box-sizing: border-box; box-sizing:
border-box; to the properties of the div?

The Tantek hack IIRC gives an IE-specific width, followed by a syntax that
hides the rest of the style from IE so reasserts the correct width.

The -moz-box-sizing is only supported by Mozilla (AIUI).

So the question you need to answer is - what do you need to happen to CSS
capable browsers other than IE and recent versions of Mozilla? Answer that,
and you'll also have an answer to your question.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top