|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Graphics & Design Discussion Forum Post your graphics design questions/comments/ideas in here. Ask questions, post tutorials, discuss trends and best practices. Sub-forum for website accessibility and usability. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Code:
<html>
<head>
<style>
label {
width: 5em;
border: 1px dotted;
}
</style>
</head>
<body>
<form>
<label for="xyz">
XYZ:
<input id="xyz" type="text" size="20">(additional hint)
</label>
</form>
</body>
</html>
I'd expect that even in the default (display: inline; or no display rule as above) it breaks lines when it reaches the width limit. Why does it not do that? And anyway, does that display or float rule not apply to how the label shows in it's containing element (form or fieldset)? Why would it affect the stuff INSIDE the label, since float is not inheritable? Confused... |
|
|||
|
Thanks for the reply. It may have to do sth with inline vs. block-level elements. But wrapping labels around input fields is definitely allowed. W3.org, the HTML standards body, even has an example showing this technique in the HTML specs:
Forms in HTML documents (see third example at 17.9.1 "The LABEL element") I wanted to use this to avoid cluttering up my code with so many divs, instead just styling fieldsets and labels directly. But anyway, yes, it does seem like <label> behaves like an inline element by default. So I guess all inline elements can't have width styles? |
|
||||
|
I agree with wige and w3schools.com - label tags shouldn't normally contain anything other than text.
The W3.org example (no 3) you quote refers to implicit association. Notice the label tags don't contain a for attribute.
__________________
There are 10 types of people in this world: those who understand binary and those who don't. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CSS styling for HR | ArthurKay | Graphics & Design Discussion Forum | 3 | 09-09-2007 08:19 AM |
| Styling <ul> as <select>with CSS | thindenim | Graphics & Design Discussion Forum | 2 | 06-05-2007 04:45 PM |
| Styling Content with and without CSS | Dcrux | Content Discussion Forum | 19 | 02-07-2006 06:30 PM |
| Google Ignores <h1> tag | janeth | Google Discussion Forum | 84 | 10-07-2004 08:40 PM |
| Google Ignores Robots.txt | jestep | Google Discussion Forum | 1 | 09-03-2004 01:39 PM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |