4 replies [Last post]
sarav_dude
sarav_dude's picture
Offline
Regular
Last seen: 5 years 51 weeks ago
Timezone: GMT+5.5
Joined: 2007-02-22
Posts: 29
Points: 0

Good day to all. Smile

I have read a css book in which i have read an example that we can access elements styles via their attributes, for instance: if i have to style all the input elements whose whose type attribute is text ()

input[type="text"]{ border:1px solid #ff0000; ... }

The above style should apply to all the input element whose type attribute is text. But they are not working as read. So i want to know that am i missing something ... how could i achieve this ? the reason i want to learn this method is because it will make the css file a smaller and more control on all the elements without bothering to add class attributes.

So anyone here could share their thoughts regarding this. :thumbsup:

Experience the Organized Web!
Its the Fastest, Most Accessible way to Save Bookmarks Online. Users can Save, Share, Discover favorite Bookmarks and more. https://www.urlsave.net

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 46 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

And in which browser/s is

And in which browser/s is this not working?

Did your book explain in footnote or otherwise the biggest problem with using attribute selectors, namely that IE6 suports none of them, and IE7 provided support for a couple iirc, so sadly given total lack of support in IE6 they are next to useless unless used as a means to hide/filter rules from IE, which isn't really their purpose.

It's a shame as they promissed a degreee of control that would have been a joy but IE essentially rendered them all but useless to us!

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

sarav_dude
sarav_dude's picture
Offline
Regular
Last seen: 5 years 51 weeks ago
Timezone: GMT+5.5
Joined: 2007-02-22
Posts: 29
Points: 0

Yes IE6 seems to be

Yes IE6 seems to be unaffected with those methods. Firefox does support this method, but it is useless to use this way.

So final conclusion is that we should not use it or their is any other way which we can workout with IE6 too.

Experience the Organized Web!
Its the Fastest, Most Accessible way to Save Bookmarks Online. Users can Save, Share, Discover favorite Bookmarks and more. https://www.urlsave.net

Hugo
Hugo's picture
Offline
Moderator
London
Last seen: 7 years 46 weeks ago
London
Joined: 2004-06-06
Posts: 15668
Points: 2806

I think that many of us were

I think that many of us were excited when we first came across them, I know I was as the possibilities for styling using them took CSS forward by leaps and bounds but then when you find that the majority browser in use had zero support for them, there seemed little point in making any meaningful use of them, I've never used them except for fun or where I simply cared not that they wouldn't work in IE but that that didn't detract from things e.g setting a bullet graphic to http links to denote external links.

Use them but remember that as they won't work for IE they have to be used in some fashion that doesn't break the site styling without them.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

sarav_dude
sarav_dude's picture
Offline
Regular
Last seen: 5 years 51 weeks ago
Timezone: GMT+5.5
Joined: 2007-02-22
Posts: 29
Points: 0

Yes i was also excited with

Yes i was also excited with that , well thanks for the useful advice Smile

Experience the Organized Web!
Its the Fastest, Most Accessible way to Save Bookmarks Online. Users can Save, Share, Discover favorite Bookmarks and more. https://www.urlsave.net