Go Back   SitePoint Forums > Forum Index > Design Your Site > Web Page Design > HTML and XHTML
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Jul 4, 2003, 10:46   #1
jofa
Sultan of Ping
 
jofa's Avatar
 
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>
    ...
jofa is offline   Reply With Quote
Old Jul 4, 2003, 11:04   #2
Patriarch
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.
Patriarch is offline   Reply With Quote
Old Jul 4, 2003, 11:08   #3
vgarcia
☆★☆★
silver trophy
 
vgarcia's Avatar
 
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
vgarcia is offline   Reply With Quote
Old Jul 4, 2003, 11:43   #4
mattjacob
SitePoint Wizard
 
Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
What about the HTML <blink> tag? That's one you don't see being used too often these days.
mattjacob is offline   Reply With Quote
Old Jul 4, 2003, 11:49   #5
jofa
Sultan of Ping
 
jofa's Avatar
 
Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
Quote:
Originally Posted by mattjacob
What about the HTML <blink> tag? That's one you don't see being used too often these days.
Useful HTML elements!
jofa is offline   Reply With Quote
Old Jul 4, 2003, 11:50   #6
vgarcia
☆★☆★
silver trophy
 
vgarcia's Avatar
 
Join Date: Jan 2002
Location: in transition
Posts: 21,481
Quote:
Originally Posted by mattjacob
What about the HTML <blink> tag? That's one you don't see being used too often these days.
It's now covered in CSS, unfortunately:
Code:
.annoying {
     text-decoration: blink;
}
vgarcia is offline   Reply With Quote
Old Jul 4, 2003, 12:18   #7
mattjacob
SitePoint Wizard
 
Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
Quote:
Originally Posted by jofa
Useful HTML elements!
OK, OK, fair enough. Nobody mentioned using <strong> and <em> in place of <b> and <i>. As far as CSS goes, I've found the following to be pretty useful as of late:
Code:
form.oneLineForm {
display: inline;
}
I had to use that for a project at work where the client wanted a text blurb ('Enter your email address'), followed immediately by an input field, followed by a 'Go' button... all on the same line.
mattjacob is offline   Reply With Quote
Old Jul 4, 2003, 12:32   #8
Hierophant
Your Lord and Master, Foamy
gold trophy
 
Hierophant's Avatar
 
Join Date: Aug 1999
Location: Lancaster, Ca. USA
Posts: 12,732
Quote:
Originally Posted by Patriarch
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.
NOWRAP is deprecated. You should use the word-space property in CSS.
Hierophant is offline   Reply With Quote
Old Jul 4, 2003, 13:32   #9
redux
gingham dress, army boots...
silver trophy
 
redux's Avatar
 
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 ?
redux is offline   Reply With Quote
Old Jul 4, 2003, 13:37   #10
mattjacob
SitePoint Wizard
 
Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
Quote:
Originally Posted by redux
but while i'm here...any of you ever use the <q> tag ? [img]images/smilies/smile.gif[/img]
If I have, I certainly can't remember it! What do you personally use it for?
mattjacob is offline   Reply With Quote
Old Jul 4, 2003, 13:50   #11
jofa
Sultan of Ping
 
jofa's Avatar
 
Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
Quote:
Originally Posted by redux
90% of developers ? hmmm....i must fall into the 10% then...
Lucky you

Quote:
Originally Posted by Poll in HTML and XHTML Forum
The label element - ever use it?
Always/often [ 1 ] 11.11%
sometimes/rarely [ 0 ] 0%
Never [ 8 ] 88.89%
OK, now I see that total votes is only 9 , but I still think the number 90% is correct
For example; does this forum use the <label> tag?
jofa is offline   Reply With Quote
Old Jul 4, 2003, 13:54   #12
jofa
Sultan of Ping
 
jofa's Avatar
 
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
jofa is offline   Reply With Quote
Old Jul 4, 2003, 14:20   #13
Hierophant
Your Lord and Master, Foamy
gold trophy
 
Hierophant's Avatar
 
Join Date: Aug 1999
Location: Lancaster, Ca. USA
Posts: 12,732
Quote:
Originally Posted by jofa
Lucky you



OK, now I see that total votes is only 9 , but I still think the number 90% is correct
For example; does this forum use the <label> tag?
No this forum doesn't. However when vBulletin 3.0 final is released, the default templates will use the label tag appropriately. They will also use the fieldset and legend tags.

<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?
Hierophant is offline   Reply With Quote
Old Jul 4, 2003, 14:40   #14
redux
gingham dress, army boots...
silver trophy
 
redux's Avatar
 
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" )
redux is offline   Reply With Quote
Old Jul 4, 2003, 15:04   #15
mattjacob
SitePoint Wizard
 
Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
Quote:
Originally Posted by redux
checkboxes with a proper label associated can be ticked by clicking on the label text itself, and not just the box
And if you want to get crafty about it, you could do something like this:
Code:
<label for="email" accesskey="e"><span class="underline">E</span>mail address:</label> 
<input name="email" type="text" id="email" />
I also usually apply the pointer cursor to <label> via CSS:
Code:
label {
	cursor: pointer;
}
mattjacob is offline   Reply With Quote
Old Jul 4, 2003, 15:44   #16
vgarcia
☆★☆★
silver trophy
 
vgarcia's Avatar
 
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 .
vgarcia is offline   Reply With Quote
Old Jul 4, 2003, 16:59   #17
jofa
Sultan of Ping
 
jofa's Avatar
 
Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
Quote:
Originally Posted by mattjacob
<span class="underline">E</span>
Being picky; isn't "underline" a bad name for a css class, should be "initial" or something?
jofa is offline   Reply With Quote
Old Jul 4, 2003, 17:11   #18
jofa
Sultan of Ping
 
jofa's Avatar
 
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:
Originally Posted by w3.org
For user agents that cannot display images, forms, or applets, this attribute specifies alternate text.
title
Quote:
Originally Posted by w3.org
This attribute offers advisory information about the element for which it is set.
Some browsers (read: IE) use the alt attribute as title (i.e. "tool tip") if no title is supplied
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
jofa is offline   Reply With Quote
Old Jul 4, 2003, 21:18   #19
Cam
********* Wizard
silver trophy
 
Cam's Avatar
 
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
Cam is offline   Reply With Quote
Old Jul 4, 2003, 21:19   #20
Cam
********* Wizard
silver trophy
 
Cam's Avatar
 
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.
Cam is offline   Reply With Quote
Old Jul 4, 2003, 22:00   #21
Darin
Vancouver Profile
 
Darin's Avatar
 
Join Date: Sep 2001
Location: Vancouver
Posts: 801
Quote:
Originally Posted by mattjacob
And if you want to get crafty about it, you could do something like this:
Code:
<label for="email" accesskey="e"><span class="underline">E</span>mail address:</label> 
<input name="email" type="text" id="email" />
I also usually apply the pointer cursor to <label> via CSS:
Code:
label {
	cursor: pointer;
}
I don't get what the accesskey="e" does?
Darin is offline   Reply With Quote
Old Jul 4, 2003, 22:11   #22
hurricane.uk
SitePoint Addict
 
hurricane.uk's Avatar
 
Join Date: May 2003
Location: Liverpool
Posts: 361
Quote:
Originally Posted by Darin
I don't get what the accesskey="e" does?
It passes the focus to the label when the access key is typed. So typing e would focus the cursor at that label, and from there to the input box etc, or in this case the email client.
hurricane.uk is offline   Reply With Quote
Old Jul 5, 2003, 00:47   #23
Webnauts
Organic SEO Expert
 
Webnauts's Avatar
 
Join Date: Jun 2003
Location: European Union
Posts: 1,577
Quote:
Originally Posted by vgarcia
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
<Q> not?
Webnauts is offline   Reply With Quote
Old Jul 5, 2003, 02:39   #24
mattjacob
SitePoint Wizard
 
Join Date: Oct 2001
Location: Tucson, Arizona
Posts: 1,921
Quote:
Originally Posted by hurricane.uk
or in this case the email client.
...or in this case a text field.
mattjacob is offline   Reply With Quote
Old Jul 5, 2003, 04:23   #25
jofa
Sultan of Ping
 
jofa's Avatar
 
Join Date: Mar 2002
Location: Svíþjóð
Posts: 4,101
Quote:
Originally Posted by w3.org
... Q is intended for short quotations (inline content) that don't require paragraph breaks.
I guess <q> is better than adding "static" quotation marks, because quotations can be rendered in different ways in different languages etc, and it should be possible to make nested quotations behave correctly (inner/outer quotation marks using ' and ")
jofa is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 01:44.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved