In my page body, I already have a:link and a:hover .
a:link
a:hover
But now I have another div tag where I need different a:link , a:hover and a:visited .
a:visited
How to do it?
In CSS:
div.classname a:link { color: #123456; } div.classname a:hover { color: #123; } div.classname a:visited { color: #654321; }
In HTML:
<div class="classname"> <a href="#link">link</a> </div>
Assign a class to the div. sort of
<div> <a></a> //style from a:link and a:hover </div> <div class="my-div"> <a></a> //style from a:link and a:hover overridden by styles from .my-div a:link and .mydiv a:hover </div>
Style
a:link{} //old link a:hover{} .my-div a:link{} //second link .my-div a:hover{}
You can bind css selectors to form different combinations of styles.
You can use the child select method:
div.one > a { color:blue; } div.two > a { color:red; }
will work for
<div class=''><a>link</a></div>
but not
<div class=''><p><a>link</a></p></div>
You can use! important like this if the above code doesn't work
.classname > a:hover{color:red !important;} .classname > a:link{color:red !important;} .classname > a:visited{color:red !important;}
Source: https://habr.com/ru/post/1333142/More articles:HTTPS message - what am I doing wrong? - postjQuery UI Datepicker will not accept unix timestamp as default - jqueryWhere should the configuration files be stored? - pythonHow to set up a login screen for Windows Vista and 7? - windowsUnable to use UIPanGestureRecognizer to move UIImageView - iphoneIntegration with Windows Login - securityGet the current theme when starting the application - Windows Phone 7 - windows-phone-7Regular expression for the alphabet with accent - c #Is it possible to save the file in SVN, which cannot be seen by other users - svnServer solution on Rails - androidAll Articles