TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Label.css – an easy way to label DOM elements

115 点作者 hoseiin大约 12 年前

17 条评论

wittjeff大约 12 年前
This is cool. If you add automatic support for the ARIA-label property (just duplicate your text content in the ARIA-label), this could be an accessibility tool. Otherwise you're basically hiding potentially needed info, which might normally be in ToolTips, from users with disabilities.<p>See <a href="https://developer.mozilla.org/en-US/docs/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute" rel="nofollow">https://developer.mozilla.org/en-US/docs/Accessibility/ARIA/...</a> for info and <a href="http://freedomscientific.com/products/fs/JAWS-product-page.asp" rel="nofollow">http://freedomscientific.com/products/fs/JAWS-product-page.a...</a> for a demo of the most popular screen reader for blind users.<p>You might also want to think about tying your CSS colors to system colors, to support users who use High Contrast mode.
aegiso大约 12 年前
For the curious, the way this works is ::before/::after selectors with content: attr() to bind the data attributes, which are position: absolute 'd within the parent, possibly transitioned.<p>Zero JS.<p>If you haven't played with CSS3 lately you might be surprised what it can do. I know I was a blown away when I discovered it could do data binding. Brings to mind a great I/O talk that introduced me to a lot of this stuff:<p><a href="http://www.htmlfivecan.com/" rel="nofollow">http://www.htmlfivecan.com/</a>
lancer383大约 12 年前
While I like the simplicity of this, I would recommend to keep accessibility in mind: information put into a data attribute will not be accessible to screenreaders, and they would miss any information stored via this method.<p>It may make sense to append the label information to whatever is being used for the image's ALT attribute.
评论 #5725060 未加载
ww520大约 12 年前
What's the difference between using the label CSS class and just setting the title attribute to get the tooltip popup?
herge大约 12 年前
Fun fact: Even if Mr. Emrani has put a copyright notice in the README.md, it doesn't apply in the United States! I wonder if the warranty notice is also also moot?
评论 #5725304 未加载
tehwebguy大约 12 年前
This rules, it is exactly what I have been dreading having to create for a project I am currently working on.<p>Not sure if you are the creator (edit: you probably are, I just saw your username here matches the twitter account in the comments) but the Usablica &#38; Github links at the top link to #
评论 #5724462 未加载
评论 #5724577 未加载
评论 #5724564 未加载
avargas大约 12 年前
usabli.ca has been kicking ass lately. I'm actually very happy to see this is a team coming from a country like Iran.
评论 #5725501 未加载
non-sense大约 12 年前
This is very neat and useful. Thanks for creating and sharing! Good to see new works coming from Tehran. IIRC, it was itro.js. Keep it up!
eridius大约 12 年前
Neat, but Fade didn't actually fade (in Safari).
评论 #5727646 未加载
评论 #5726743 未加载
quackerhacker大约 12 年前
Nice, clean and simple! I love how your utilizing CSS3 and the very simple html5! Mad props!
zee007大约 12 年前
Dropping my props as well. Great work. Very clean and simple.
acron0大约 12 年前
Very neat, very slick. What more could you want?
afshinmeh大约 12 年前
Great! Keep up the good work.
shakiba大约 12 年前
Boys, I'm prude of you!
senorprogrammer大约 12 年前
Nicely done!
1admin大约 12 年前
Nice job mate :)
MehdiEmrani大约 12 年前
that's great for labeling every thins that you want