473,405 Members | 2,287 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

css chestnut

Tim
I'm slowly moving from Table layout to CSS layout.
Yes I know the benefits, but hell I spend about 99% of my time tweaking
the css to work on different browsers. Tables are almost exactly the
same on any browser. If they do go wrong you might get a hairline of
color where you don't want it.

When CSS goes wrong though, it goes properly wrong.

So a question for you CSS fans out there...

If I have a block of text 200px wide, and add a 10px margin, firefox
gives me a 220px wide box, and IE gives me a 200px wide box. I've seen
that there's a hack for this including some wierd voice tag, but with
something so fundementally different what are we supposed to do? It's
making CSS pretty much unusable for me as a method for layout.

You thoughts...

Jul 17 '06 #1
9 1195
Tim wrote:
I'm slowly moving from Table layout to CSS layout.
Great news!
If I have a block of text 200px wide, and add a 10px margin,
Try adding a 10px padding, instead of a margin. ?

Better yet, use em units instead of px or pt, so the box will scale when
your visitor increases text size. Use px only for widths of borders and
the like. And image height and width, of course.

--
-bts
-Warning: I brake for lawn deer
Jul 17 '06 #2
Tim
erm, doesn't padding do exactly the same thing?
Beauregard T. Shagnasty wrote:
Tim wrote:
I'm slowly moving from Table layout to CSS layout.

Great news!
If I have a block of text 200px wide, and add a 10px margin,

Try adding a 10px padding, instead of a margin. ?

Better yet, use em units instead of px or pt, so the box will scale when
your visitor increases text size. Use px only for widths of borders and
the like. And image height and width, of course.

--
-bts
-Warning: I brake for lawn deer
Jul 17 '06 #3
Rik
Tim wrote:

Don't toppost.
Beauregard T. Shagnasty wrote:
>Tim wrote:
>>I'm slowly moving from Table layout to CSS layout.

Great news!
Yup, welcome to css, one of the first things you will learn is that MSIE
sucks.
>>If I have a block of text 200px wide, and add a 10px margin,

Try adding a 10px padding, instead of a margin. ?
erm, doesn't padding do exactly the same thing?
No, simplified: padding is the distance from the outside of the box to the
content of that box, margin the distance from the outside of the box to the
other content.

And I rarely have to use both a width and a margin for a block of text.
Maybe if you tell us more (perhaps post a url) about what exactly you're
trying to accomplish we have an easier (cross browser) method.
>Better yet, use em units instead of px or pt, so the box will scale
when your visitor increases text size. Use px only for widths of
borders and the like. And image height and width, of course.
Amen.

--
Rik Wasmus
Jul 17 '06 #4
Tim
just tested - and you might be right!

thanks

TIm
Tim wrote:
erm, doesn't padding do exactly the same thing?
Beauregard T. Shagnasty wrote:
Tim wrote:
I'm slowly moving from Table layout to CSS layout.
Great news!
If I have a block of text 200px wide, and add a 10px margin,
Try adding a 10px padding, instead of a margin. ?

Better yet, use em units instead of px or pt, so the box will scale when
your visitor increases text size. Use px only for widths of borders and
the like. And image height and width, of course.

--
-bts
-Warning: I brake for lawn deer
Jul 17 '06 #5
Tim
what is top posting?

another problem is borders.
IE puts them inside, and FF outside (or the other way around).

what a pain!
how do you overcome this headache?

Tim

Rik wrote:
Tim wrote:

Don't toppost.
Beauregard T. Shagnasty wrote:
Tim wrote:

I'm slowly moving from Table layout to CSS layout.

Great news!

Yup, welcome to css, one of the first things you will learn is that MSIE
sucks.
>If I have a block of text 200px wide, and add a 10px margin,

Try adding a 10px padding, instead of a margin. ?
erm, doesn't padding do exactly the same thing?

No, simplified: padding is the distance from the outside of the box to the
content of that box, margin the distance from the outside of the box to the
other content.

And I rarely have to use both a width and a margin for a block of text.
Maybe if you tell us more (perhaps post a url) about what exactly you're
trying to accomplish we have an easier (cross browser) method.
Better yet, use em units instead of px or pt, so the box will scale
when your visitor increases text size. Use px only for widths of
borders and the like. And image height and width, of course.

Amen.

--
Rik Wasmus
Jul 17 '06 #6
Tim wrote:
what is top posting?
Posting above the quoted reply. Notice how everyone else is posting
below the quote - inline, so to speak - in the manner of a conversation.

http://oakroadsystems.com/genl/unice.htm#upside

open the front cover and begin reading there?
the back cover and end up at the front or do you
chapter one or do you start somewhere near
When reading a book, do you start at
another problem is borders.
IE puts them inside, and FF outside (or the other way around).
IE gets so many things wrong.
what a pain!
how do you overcome this headache?
"Best viewed in a *modern* *conforming* browser!!!!1!!!"

Actually, careful thought to design can eliminate most irregularities by
not striving for a 'pixel-perfect' layout. Make boxes and divs such that
there is some white-space between, so a few extra pixels does not upset
your layout.

--
-bts
-Warning: I brake for lawn deer
Jul 17 '06 #7
Rik
Tim wrote:
Rik wrote:
>Tim wrote:
Don't toppost.
what is top posting?
This:
You: Now, don't push your luck...
Me: And now that you've come all this way, also cut the bits from quotes
that are no longer relevant to the conversation.
You: Ah, now I know. I see the error of my ways and will stop topposting.
Me: There is such a thing as netiquette, google it.
You: But a lot of others do it, and I think it's simpler
Me: Because then the conversation makes more sence.
You: Why should I?
Me: Please reply beneath the text of the original poster

another problem is borders.
IE puts them inside, and FF outside (or the other way around).
what a pain!
how do you overcome this headache?
Depends on the circumstances. I normally display:block, and set left- &
rightmargins.

Grtz,
--
Rik Wasmus
Jul 17 '06 #8
Tim
one more while I'm here...

if I have 3 divs, all floated left, all set to width 33% they should
fill the screen width ways (short of a couple of pixels). IE does fine.
FF fails and the 3rd box drops down. It appears to be the dreaded
padding of the text blocks. If I remove the padding then all is well.
FF seems to calculate the 33% width, and then add on the padding. That
must be wrong?!?!

Jul 17 '06 #9
Rik
Tim wrote:
one more while I'm here...

if I have 3 divs, all floated left, all set to width 33% they should
fill the screen width ways (short of a couple of pixels). IE does
fine. FF fails and the 3rd box drops down. It appears to be the
dreaded padding of the text blocks. If I remove the padding then all
is well. FF seems to calculate the 33% width, and then add on the
padding.
Yep, had that problem before.
That must be wrong?!?!

In the W3C box model, the width of an element gives the width of the content
of the box, excluding padding and border.In the traditional box model, the
width of an element gives the width between the borders of the box,
including padding and border.

Reading material and work-arounds:
http://www.quirksmode.org/css/box.html

Grtz,
--
Rik Wasmus
Jul 17 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

42
by: Jim Smith | last post by:
Note the cross-posting - but no flame wars please. This question was prompted by a thread on the a postgres mailing list during which someone (Gregory Williamson) claimed <quote> raw devices,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.