stylesheet - CSS a way to reference previous div style to save space? -
i making simple button in css , need create 4. want them have same style first 1 created different words in them. there way can reference nav1 styles nav2 save on space? hope makes sense. thanks
#nav1 { background-color:white; -webkit-transition: .6s; width:90px; line-height:50px; text-align:center; font-family: sans-serif; font-weight: bold; border-radius: 5px; position:relative; top: 10px; } #nav1:hover { background-color:black; color:white; } #nav2 { background-color:white; -webkit-transition: .6s; width:90px; line-height:50px; text-align:center; font-family: sans-serif; font-weight: bold; border-radius: 5px; position:relative; top: 20px; } #nav2:hover { background-color:black; color:white; }
yes. can add together same css properties multiple ids, classes, elements separating them commas:
#nav1, #nav2, .., #nav100 { background-color:white; -webkit-transition: .6s; width:90px; line-height:50px; text-align:center; font-family: sans-serif; font-weight: bold; border-radius: 5px; position:relative; top: 10px; }
to alter 1 property overwrite it:
#nav2 { top: 20px; }
but in case should utilize classes:
.nav { .. }
html:
<div class="nav"></div> <div class="nav"></div> ...
css stylesheet
No comments:
Post a Comment