Dev.Opera - Follow the standards, break the rulesDev.Opera - Follow the standards, break the rules

Login

Lost password?

Forums » Article Discussions

Discuss the articles posted on Dev.Opera.

Note: You need to login to post in the forums. if you don't have an account you first need to sign up.

By teleject anchor Thursday, 25. October 2007, 18:54:27

Styling Forms with Attribute Selectors - Part 1

This is an exciting article, marking the first of a multiple part series by renowned CSS author Christopher Schmitt that explores modern CSS design techniques, mainly focused around implementing CSS3 techniques that gracefully degrade if browser support is not there. This particular article covers attribute selectors.

( Read the article )

By scipio anchor Wednesday, 7. November 2007, 17:52:02

avatarWhy do you use
label[for="byear"], label[for="bdate"] {
  position: absolute;
  left: -999px;
  width: 990px;
}
instead of the following?
label[for="byear"], label[for="bdate"] {
  display: none;
}

By hzr O anchor Wednesday, 7. November 2007, 20:03:38

avatarscipio, that is a trick to hide stuff visibly. It will still be read by screen readers though, which wouldn't be the case with your solution.

By AyushJ anchor Wednesday, 7. November 2007, 20:42:14

avatarscipio, the reason is mentioned after the screenshot:

Note that typically we could remove an element like the two label elements above using the display property set to none. However, this presents an accessibility issue - almost all screenreaders would miss out the elements hidden in this fashion. So, in order to keep the content available for readers with visual impairments, set the position to absolute and move it out of the way with the left properties.

By scipio anchor Monday, 12. November 2007, 13:41:08

avatar

Originally posted by AyushJ:

scipio, the reason is mentioned after the screenshot:


Originally posted by hzr:

scipio, that is a trick to hide stuff visibly. It will still be read by screen readers though, which wouldn't be the case with your solution.


Thanks for your replies, I had clearly missed that explanation. :happy: It still looks a bit like a hack though, isn't there a more elegant way to do this?

By dAEk anchor Monday, 12. November 2007, 21:53:07

avatar

Originally posted by hzr:

scipio, that is a trick to hide stuff visibly. It will still be read by screen readers though, which wouldn't be the case with your solution.


Actually, labels hidden with display: none will be read by screen readers, or at least in Jaws last time I checked.

Moderators: pepelsbey | dstorey | mcx | operadev | chrismills | shwetankdixit | brucelawson | iheni | andreasbovens | zibin | mollydotcom