#menu1, #menu2 {
border: 1px solid #000;
list-style-type: none;
margin: 0;
padding: 0;
width: 250px;
}
#menu1 li, #menu2 li {
padding: 5px;
}
#menu1 li {
background-color: #FFFF00;
}
#menu1 li a:hover {
background-color: #FFFF4D;
}
#menu2 li {
background-color: #FF0000;
}
#menu2 li a:hover {
background-color: #FF4D4D;
/**
* Transforma o link em elemento de bloco,
* assim o width do <li> sejá válido <a>
*/
display: block;
/**
* Compensamos o padding dado ao <li> para que
* não exista uma área de 5px em torno do link
* não preenchida pela nova cor
*/
margin: -5px;
/**
* Reaplicamos o padding para que quanto mouse passar
* o elemento não sofra um efeito sanfona
* (encolhe/expande - comente essa linha para ver)
*/
padding: 5px;
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.