|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Sultan of Ping
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
|
Useful HTML elements that 90% of all developers are unaware of
This week I "discovered" the <fieldset> element, which has been around for several years, but was completely unknown to me - until now (thank you beetle !
)I really like this way of creating something similar to a GroupBox/Frame control in a WinForms application (<legend> == Text/Caption) Think I will use it very extensively to group related fields in the future ![]() Another element, that I knew existed, and also have used a lot in my forms is the <label> element However, I've noticed that using <label>s next to form elements is unusual, I guess it can't hurt to talk about that one too In fact, why not encourage you all to resurrect "unknown" elements, attributes etc that you believe are useful but rarely used by the majority? Finally, a little example, how to use <fieldset> and <label> Code:
...
<form action="">
<fieldset>
<legend>My favourite thing is...</legend>
<input type="radio" id="optFav0" name="optFav">
<label for="optFav0">Raindrops on roses</label><br>
<input type="radio" id="optFav1" name="optFav">
<label for="optFav1">Whiskers on kittens</label><br>
<input type="radio" id="optFav2" name="optFav">
<label for="optFav2">Bright copper kettles</label>
</fieldset>
<p><input type="submit"></p>
</form>
...
|
|
|
|
|
|
#2 |
|
SitePoint Enthusiast
![]() Join Date: Apr 2002
Posts: 38
|
I've got two, one is an HTML attribute, the other is a CSS gem.
Well, I just recently finished writing an XHTML/CSS frontend to a SQL Server database at work, and one of the requirements was to print out coversheets for documents contained in the database. This usually isn't too hard, the catch was that my boss wanted several records printed out at once, and all on seperate pages. At first I thought I'd have to do some fancy JavaScript or use some kind of messy browser plugin, when I realized through the magic of CSS and XHTML, that I could use the page-break-after which automatically breaks to a new page after the closing tag of the container element! A nice little HTML element that's been around for awhile, but I haven't seen used often is the NOWRAP attribute, which is a lifesaver when you just can't have that table cell wrap. ![]() |
|
|
|
|
|
#3 |
|
☆★☆★
![]() Join Date: Jan 2002
Location: in transition
Posts: 21,481
|
Forgotten elements/properties:
HTML tags: <abbr> <acronym> <caption> <col> <colgroup> <th> <thead> <tbody> <tfoot> CSS Properties: text-transform white-space position: fixed; margin: auto; seems to be unknown too |
|
|
|
|
|
#7 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
|
Quote:
Code:
form.oneLineForm {
display: inline;
}
|
|
|
|
|
|
|
#8 | |
|
Your Lord and Master, Foamy
![]() Join Date: Aug 1999
Location: Lancaster, Ca. USA
Posts: 12,732
|
Quote:
|
|
|
|
|
|
|
#9 |
|
gingham dress, army boots...
![]() Join Date: Apr 2002
Location: Salford / Manchester / UK
Posts: 4,856
|
90% of developers ? hmmm....i must fall into the 10% then...
![]() but while i'm here...any of you ever use the <q> tag ? ![]() |
|
|
|
|
|
#10 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
|
Quote:
|
|
|
|
|
|
|
#11 | ||
|
Sultan of Ping
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
|
Quote:
![]() Quote:
, but I still think the number 90% is correctFor example; does this forum use the <label> tag? |
||
|
|
|
|
|
#12 |
|
Sultan of Ping
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
|
And I still think this thread is a good idea, and Vinnie posting e.g. the <th> is excellent, beacuse a lot of people don't know that it exists, another lot of people never uses it etc etc
|
|
|
|
|
|
#13 | |
|
Your Lord and Master, Foamy
![]() Join Date: Aug 1999
Location: Lancaster, Ca. USA
Posts: 12,732
|
Quote:
<th> is one of my favorite tags. I use it whenever I create a table for the column headers. Makes formatting so much easier because I can apply it directly to the tag instead of a class to differentiate the column headers from standard data cells. What about <tfoot>? I see a lot of people use <tbody> but hardly ever see <tfoot> used. While we are on the subject of tables, I haven't seen many people use the caption, colgroup or col elements in the past either. Does anyone use any of these? |
|
|
|
|
|
|
#14 |
|
gingham dress, army boots...
![]() Join Date: Apr 2002
Location: Salford / Manchester / UK
Posts: 4,856
|
i use <label> all the time...i'm required to make my work site (uk university) accessible to at least W3C WAI Level A or better...so labelling my form elements is a must...and it has a huge number of "coincidental" advantages (e.g. checkboxes with a proper label associated can be ticked by clicking on the label text itself, and not just the box...making them a lot easier to "hit"
) |
|
|
|
|
|
#15 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
|
Quote:
Code:
<label for="email" accesskey="e"><span class="underline">E</span>mail address:</label> <input name="email" type="text" id="email" /> Code:
label {
cursor: pointer;
}
|
|
|
|
|
|
|
#16 |
|
☆★☆★
![]() Join Date: Jan 2002
Location: in transition
Posts: 21,481
|
I'm a heavy user of <fieldset>, <legend>, and <label>
. The first time I used fieldset and legend at work people thought I used some kind of CSS hack to get the "framed" appearance . |
|
|
|
|
|
#17 | |
|
Sultan of Ping
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
|
Quote:
![]() |
|
|
|
|
|
|
#18 | ||
|
Sultan of Ping
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
|
Two well known attributes, but does everyone know what they are meant for?
alt Quote:
Quote:
Other browsers (read: Mozilla) display a "tool tip" only when title is set And then some people get it all wrong and accuse Mozilla of being wrong ![]() |
||
|
|
|
|
|
#19 |
|
********* Wizard
![]() Join Date: Aug 2002
Location: Burpengary, Australia
Posts: 4,601
|
I've used <th> for a while now, the first time I found it was when I was modding phpBB and they used <th> and I did a search and found out what it was.
<fieldset> and <legend>, I also knew of their existence but only because they are used at PHP and I saw them, thought they looked interesting and checked out the code. There is a lesson to be learned here, if you visit another site and think something there is nifty, check the source. It might just be something simple that you never knew about ![]() |
|
|
|
|
|
#20 |
|
********* Wizard
![]() Join Date: Aug 2002
Location: Burpengary, Australia
Posts: 4,601
|
Also, with <strong> and <em>, I've heard somewhere (I think) that they are occasionally rendered differently in different browsers but should still be used as aural browsers and such use them to accent words and stuff.
|
|
|
|
|
|
#21 | |
|
Vancouver Profile
![]() ![]() ![]() ![]() ![]() Join Date: Sep 2001
Location: Vancouver
Posts: 801
|
Quote:
|
|
|
|
|
|
|
#22 | |
|
SitePoint Addict
![]() ![]() ![]() Join Date: May 2003
Location: Liverpool
Posts: 361
|
Quote:
|
|
|
|
|
|
|
#23 | |
|
Organic SEO Expert
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2003
Location: European Union
Posts: 1,577
|
Quote:
![]() |
|
|
|
|
|
|
#24 | |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
|
Quote:
![]() |
|
|
|
|
|
|
#25 | |
|
Sultan of Ping
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
|
Quote:
|
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 01:44.




)





, but I still think the number 90% is correct



Linear Mode
