472,352 Members | 1,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Firefox ignores CSS "width" property?

I'm not sure what I'm doing wrong.

I have a form that has mnay input fields.
Before each input field is a label enclosed in custom LABEL tags.
Inside my CSS I have:

LABEL
{
width: 120px;
}

In Internet Explorer this is recognized and each input floats in a
nicely aligned column with all other inputs. In Firefox the LABEL
will not maintain the width. It collapses to the exact size of the
inner text. I have changed other properties inside the LABEL
definition and they are applied.

What's the deal!? All my forms in Firefox are messy, while in IE they
appear nice and neat, all inputs lined up.

Mario T. Lanza
Clarity Information Architecture, Inc.
2004.07.04
Jul 20 '05 #1
8 33773
Els
Mario T. Lanza wrote:
I'm not sure what I'm doing wrong.

I have a form that has mnay input fields.
Before each input field is a label enclosed in custom LABEL
tags. Inside my CSS I have:

LABEL
{
width: 120px;
}

In Internet Explorer this is recognized and each input
floats in a nicely aligned column with all other inputs.
In Firefox the LABEL will not maintain the width. It
collapses to the exact size of the inner text. I have
changed other properties inside the LABEL definition and
they are applied.

What's the deal!?


http://www.w3.org/TR/html4/interact/...tml#edef-LABEL

Label is an inline element, whereas only block level elements
can be given a width. The fact that IE is obeying the value
you gave to the width property, is probably due to lack of a
dtd or doctype altogether. This puts IE into quirks mode, not
standards mode.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #2
ml****@lycos.com (Mario T. Lanza) wrote:
I'm not sure what I'm doing wrong.

I have a form that has mnay input fields.
Before each input field is a label enclosed in custom LABEL tags.
Inside my CSS I have:

LABEL
{
width: 120px;
}

In Internet Explorer this is recognized and each input floats in a
nicely aligned column with all other inputs. In Firefox the LABEL
will not maintain the width. It collapses to the exact size of the
inner text. I have changed other properties inside the LABEL
definition and they are applied.

What's the deal!? All my forms in Firefox are messy, while in IE they
appear nice and neat, all inputs lined up.


Label is inline by default, thus a standard compliant UA does not honor
a specified width, set display:block to get it to stick.

--
Spartanicus
Jul 20 '05 #3
Thanks for the prompt replies!

Perhaps, rather than explaining my problem, I should have explained my
intent. I want to create forms that have neatly aligned labels and
inputs. I attempted the "display: block" and this results in the
labels and the inputs displaying on separate lines.

I want the labels to display on the same lines as their input fields.
I want the labels to always be 120px wide so that the inputs will
neatly follow and all share a common left aligment. I want to use as
little markup as possible (thus tables are out).

Suggestions?

Mario
Jul 20 '05 #4
Els
Mario T. Lanza wrote:
Thanks for the prompt replies!

Perhaps, rather than explaining my problem, I should have
explained my intent. I want to create forms that have
neatly aligned labels and inputs. I attempted the
"display: block" and this results in the labels and the
inputs displaying on separate lines.

I want the labels to display on the same lines as their
input fields. I want the labels to always be 120px wide so
that the inputs will neatly follow and all share a common
left aligment. I want to use as little markup as possible
(thus tables are out).

Suggestions?


Yep. Use a table. It is possible without a table, although I
don't know the link to the example. But it boils down to more
code than an ordinary table.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Jul 20 '05 #5
Mario T. Lanza wrote:

I want the labels to display on the same lines as their input fields.
I want the labels to always be 120px wide so that the inputs will
neatly follow and all share a common left aligment. I want to use as
little markup as possible (thus tables are out).

Suggestions?

Use a table.

--
jmm dash list at sohnen-moe dot com
(Remove .TRSPAMTR for email)
Jul 20 '05 #6
Mario T. Lanza wrote:
Thanks for the prompt replies!
To what? Why didn't you quote a few lines from the previous message so
I know what you're talking about.
I want to create forms that have neatly aligned labels and inputs.
I attempted the "display: block" and this results in the labels and
the inputs displaying on separate lines.
Float the label left. For a working demo, see

http://www.julietremblay.com/contact/
I want the labels to always be 120px wide
That's not such a great idea. Suppose the user has selected a large
font size?
so that the inputs will neatly follow and all share a common left
aligment.
Size the label element in em units, and you can still get the inputs
to line up as you want.
I want to use as little markup as possible (thus tables are out).


You should always use as little markup as possible, but not at the
cost of degrading the document. If <table> (or <p> or <code> or...) is
appropriate, use it.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #7
> http://www.julietremblay.com/contact/

This was the example I needed.

I've been using CSS for over a year. I kinda taught myself in a very
unprofessional way. Basically, I read parts of the CSS section in my
"O'Reily Dynamic HTML" book. Any CSS books you'd recommend as a
tutorial, moreso than a reference?

Thanks,
Mario
Jul 20 '05 #8
Mario T. Lanza wrote:
I've been using CSS for over a year. I kinda taught myself in a
very unprofessional way.
Me too. I've managed to teach myself better HTML methods, plus -- from
the beginning -- CSS, Javascript/DOM rudiments, PHP, and now MySQL.
Being unemployed has helped. ;-)
Any CSS books you'd recommend as a tutorial, moreso than a
reference?


I'm afraid the only book on CSS I ever read was old at the time I
wrote it; it talked about support only in NS 4 and IE 4. I've started
a book _Web Publishing_, but there's very little on CSS.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #9

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

Similar topics

15
by: Gérard Talbot | last post by:
Hello all, I'd like to know and understand the difference between, say, <img src="/ImageFilename.png" width="123" height="456" alt=""> and ...
3
by: Lasse Edsvik | last post by:
Hello I was wondering if its possible to the "width" and "height" of a text when creating a pic from text. string sometext = "bla bla"; Font...
2
by: Brian Bischof | last post by:
To get my formatting to work with Firefox and IE browsers, I have to be very careful about the layout. So I'm removing all the Style tags that set...
3
by: Phil Endecott | last post by:
Dear Experts, It looks as if the HTML4 spec does not define a meaning for empty height and width attributes in an IMG element. Moz seems to...
2
by: Brook | last post by:
In webform.aspx: <cc:ctlB ID="ctl1" runat="server" Width="200px" /> If set value to width property, I will get a error that say ctlB.Page is...
3
by: Tom | last post by:
Can someone please explain the non-working aspect of binding to Width? See code below. Thanks !! -- Tom...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.