473,388 Members | 1,376 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,388 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 33883
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 <img src="/ImageFilename.png" style="width:...
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 font = new Font("Verdana", 18); SolidBrush sb =...
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 the Height and Width values (and some of these...
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 ignore them, while IE7 sets the dimension to 1 pixel...
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 null. This control will be fine with no width...
3
by: Tom | last post by:
Can someone please explain the non-working aspect of binding to Width? See code below. Thanks !! -- Tom =================================================== using System; using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...

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.