Reputation: 27
Can someone plz explain the meaning of nodec?
I saw it is being used as a.nodec
in CSS
But totally have no idea what is the purpose of this usage.
TQ
Upvotes: 1
Views: 2215
Reputation: 16
recently I've been studying about that problem too. The is a reason for you to do a.nodec instead of just .nodec.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.underline{
text-decoration:underline;
}
</style>
</head>
<body>
<div class="underline">
<h1>this is h1</h1>
<p>this is p</p>
</div>
</body>
</html>
Assume the .underline as the .nodec and based on the code above, the output will show h1 and p underlined. For some reasons, you may only want specific element to be able to use the class (for example, you only want h1 to use the underline class). For that reason, you can specify what kind of element can only use the class you have made. Check out the code below.
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
h1.underline{ <!--just added the h1 in front of .underline-->
text-decoration:underline;
}
</style>
</head>
<body>
<div class="underline">
<h1>this is h1</h1>
<p>this is p</p>
</div>
</body>
</html>
In this case, the div won't be able to use the underline class unless you set the class for h1 element to underline (for example this is h1)
In conclusion, it's just about limiting number of element to use specific class. Hope you find this helpful!
Upvotes: 0
Reputation: 5565
If you saw something like
a.nodec {
...
}
Then "nodec" is a class name of "a" tags like in this HTML:
<a class="nodec" href="?">Link #1</a>
<a class="nodec" href="?">Link #2</a>
Upvotes: 1