CSS selector of the day
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Huh. Useful in some situations, eh?
I think computer viruses should count as life. I think it says something about human nature that the only form of life we have created so far is purely destructive. We've created life in our own image. Stephen Hawking
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Thanks for this, Chris, I think there could be a lot more to it than is immediately apparent.
The older I get the better I was mikeo
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
+5, it's nice to see some wonderful code, as oposed to the waves of weirdos... EDIT: if you can, make this really a OTD series, as a CSS Selector OTD has really a great potential...
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Thanks for the tip.
Yvan Rodrigues Red Cell Innovation Inc.
-
Nice. Are there any (*: doesn't work in browser X) conditions on this? I know the conditional selectors generally don't play nicely with IE.
BobJanova wrote:
Are there any (*: doesn't work in browser X) conditions on this
No support on IE8 and earlier, unfortunately.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
BobJanova wrote:
Are there any (*: doesn't work in browser X) conditions on this
No support on IE8 and earlier, unfortunately.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Bah... No one uses old browsers like that anyway... :)
I wasn't, now I am, then I won't be anymore.
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Thanks for posting this, and to CP for hilighting it in their newsletter email today. This is a pretty cool thing that I had not seen before, probably hidden in plain site right in front of me though.
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
Is this what you are using to prevent anchored headings in CodeProject articles from being shown in blue instead of orange? ;P
Interested in Machine Learning in .NET? Check the Accord.NET Framework. See also Handwriting Recognition Revisited: Kernel Support Vector Machines
-
Is this what you are using to prevent anchored headings in CodeProject articles from being shown in blue instead of orange? ;P
Interested in Machine Learning in .NET? Check the Accord.NET Framework. See also Handwriting Recognition Revisited: Kernel Support Vector Machines
yeah :)
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
:not
as in:a:not([href]) { color: inherit; text-decoration:none; }
This makes all A tags that don't have a href (eg a
<a name=...>
bookmark) take their colour from their parent and removes the hover underline. I just thought it was eloquent enough to share.cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP
-
Non-CSS version - as used in Netscape Navigator 4, Internet Explorer 4, and many later browsers:
text to be bookmarked
or
text to be bookmarked
Empty anchors don't always work. They should. They don't.
cheers, Chris Maunder The Code Project | Co-founder Microsoft C++ MVP