DotDragnet
May 24, 2012, 11:08:23 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Mobile users - Our forum is Tapatalk enabled. http://www.tapatalk.com/
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Hide form labels with text-indent  (Read 2314 times)
Jeep Stone
Hero Member
*****
Posts: 908



View Profile WWW Awards
« on: September 03, 2007, 12:59:13 PM »

I've got a very simple form:

Code:
<label for="name">Name:</label>
<input class="inputbox" type="text" value="Your Name" size="13" name="name"/>
<label for="email">Email:</label>
<input class="inputbox" type="text" value="Email Address" size="13" name="email"/>

What's the best way to hide the form labels? I've tried using text-indent: -5000px to push it off the page but it won't budge. Is display: none bad practice in this instance?
Logged

Chris H
Resident God Botherer
Global Moderator
Hero Member
*****
Posts: 2291



chrishall57
View Profile WWW Awards
« Reply #1 on: September 03, 2007, 01:06:28 PM »

These seem to work.

http://www.stuffandnonsense.co.uk/archives/trimming_form_fields.html

http://www.webaim.org/techniques/css/invisiblecontent/
Logged

Jeep Stone
Hero Member
*****
Posts: 908



View Profile WWW Awards
« Reply #2 on: September 03, 2007, 02:23:24 PM »

Nice one. Thanks Chris. I did this:

Code:
position:absolute;
left:0px;
top:-500px;
width:1px;
height:1px;
overflow:hidden;

and applied the class to the required labels.
Logged

vee
Full Member
***
Posts: 215



View Profile WWW Awards
« Reply #3 on: September 03, 2007, 06:23:58 PM »

Just out of interest why do you want to hide them?
Logged
Jeep Stone
Hero Member
*****
Posts: 908



View Profile WWW Awards
« Reply #4 on: September 05, 2007, 07:46:02 AM »

This is on a homepage module where  someone can enter their name/email address to signup for a newsletter. Due to the design, there isn't room to put the labels in as well so I prepopulate the form field with the label value but wanted to keep it there for semantics
Logged

Mr Anderson
DDN Contribs
Hero Member
*****
Posts: 2267



ap4a.uk ap4a
View Profile WWW Awards
« Reply #5 on: September 05, 2007, 09:52:57 AM »

This help? http://www.alistapart.com/articles/makingcompactformsmoreaccessible
Logged

Jeep Stone
Hero Member
*****
Posts: 908



View Profile WWW Awards
« Reply #6 on: September 05, 2007, 10:38:11 AM »

Yeah. That's a nice way of doing it. I've got a solution but might rework it like that if I get chance.

Thanks.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2006-2008, Simple Machines Valid XHTML 1.0! Valid CSS!