Pseudo-class :hover and :active, mouseover and mouse click on CSS
Hover mouseover on CSS
Use span:hover and the element will change color on hover.
span:hover { background-color: #1b5392; } .sign_up:hover { background-color: #1b5392; }
The button enter the site changes color when you hover the mouse.
<STYLE> .button_sign_up { width: 320px; height: 45px; font-size: 21px; padding: 10px 20px; text-align: center; border-radius: 5px; font-family: sans-serif; letter-spacing: 1px; color: #fff; background-color: #0071f0; } .button_sign_up:hover{ background-color: #1b5392; } </STYLE> <div style="text-align:center;"> <button class="button_sign_up">Sign Up</button> </div>
Use the CSS property :hover to change the color of the menu item and to open the submenu.
<style> ul { width: 180px; list-style: none; margin: 50px; padding: 0; font-family: Arial, sans-serif; font-size: 10pt; } li ul { position: absolute; /* Submenus are positioned absolutely */ display: none; /* Hide the submenu */ margin-left: 100px; /* Move the submenu to the right */ margin-top: -2em; /* Move the submenu up */ } li a { display: block; /* Link as block element */ padding: 5px; /* Margins around the label */ text-decoration: none; /* Remove underlining from links */ color: #666; border: 1px solid #ccc; background-color: #f0f0f0; border-bottom: none; /* We do not draw the border from below */ } li a:hover { color: #ffe; background-color: #5488af; } li:hover ul { display: block; } .brd { border-bottom: 1px solid #ccc; } ul.menu li { display: inline; /* Отображать как строчный } </style> <ul class="menu"> <li><a href="#" class="brd">Clients</a> <ul> <li><a href="#">Active Client</a></li> <li><a href="#">Dialog</a></li> <li><a href="#">Client BD</a></li> <li><a href="#" class="brd">Statistics Client</a></li> </ul> </li> </ul>
Active mouse click on CSS
Use span:active and the element will change color on mouse click.
span:active { background-color: #1b5392; } .sign_up:active { background-color: #1b5392; }
The button enter the site changes color when you click the mouse.
<STYLE> .button_sign_up { width: 320px; height: 45px; font-size: 21px; padding: 10px 20px; text-align: center; border-radius: 5px; font-family: sans-serif; letter-spacing: 1px; color: #fff; background-color: #0071f0; } .button_sign_up:active{ background-color: #1b5392; } </STYLE> <div style="text-align:center;"> <button class="button_sign_up">Sign Up</button> </div>
Use the CSS property :active to change the color of the menu item and to open the submenu.
<style> ul { width: 180px; list-style: none; margin: 50px; padding: 0; font-family: Arial, sans-serif; font-size: 10pt; } li ul { position: absolute; display: none; margin-left: 100px; margin-top: -2em; } li span,li a { display: block; padding: 5px; text-decoration: none; color: #666; border: 1px solid #ccc; background-color: #f0f0f0; border-bottom: none; } li a:active,li span:active { color: #ffe; background-color: #5488af; } li:hover ul { display: block; } .brd { border-bottom: 1px solid #ccc; } </style> <ul class="menu"> <li><span class="brd">Clients</span> <ul> <li><a href="#">Active Client</a></li> <li><a href="#">Dialog</a></li> <li><a href="#">Client BD</a></li> <li><a href="#" class="brd">Statistics Client</a></li> </ul> </li> </ul>
Categories: