html - How to set background color for a boxed link? -
i have link on website borders.
html:
<p id="hero4"><a href="menu.html">explore our menu</a></p>
css:
#hero4 { border:1px solid white; border-radius:5px; width:150px; height:30px; margin:auto;}
i'd entire "box" turn grey when user hovers on it, "create yours" button on starbucks website. right now, have:
#hero4 a:hover { background-color:grey;}
but small rectangular area around text turns grey. how can change css entire area within border changes color?
you can move style <p>
<a>
tag, , set display:block;
.
#hero4 { border: 1px solid blue; border-radius: 5px; width: 150px; height: 30px; margin: auto; display: block; /*added*/ text-align: center; /*extra: center text horizontally*/ line-height: 30px; /*extra: center text vertically*/ } #hero4 a:hover { background-color: grey; }
<p id="hero4"><a href="menu.html">explore our menu</a></p>
Comments
Post a Comment