html - CSS element with multiple values (px & rem) at the same time -
html - CSS element with multiple values (px & rem) at the same time -
i have css code in many elements having multiple values single css attribute.
for example, below css produce button shown below.
css
.btn-gold { display: block; text-decoration: none; font-size: 20px; font-size: 2rem; line-height: 22px; line-height: 2.2rem; color: #222; padding: 8px 0; padding: 0.8rem 0; text-align: center; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background: rgb(254,196,26); background: -moz-linear-gradient(top, rgb(254,196,26) 0%, rgb(255,170,0) 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(254,196,26)), color-stop(100%,rgb(255,170,0))); background: -webkit-linear-gradient(top, rgb(254,196,26) 0%,rgb(255,170,0) 100%); background: -o-linear-gradient(top, rgb(254,196,26) 0%,rgb(255,170,0) 100%); background: -ms-linear-gradient(top, rgb(254,196,26) 0%,rgb(255,170,0) 100%); background: linear-gradient(to bottom, rgb(254,196,26) 0%,rgb(255,170,0) 100%); -webkit-box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, .4); box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, .4); }
result
now not understanding what's purpose of giving multiple values single attribute; see font-size , line-height , padding given 2 values??
font-size: 20px; font-size: 2rem; line-height: 22px; line-height: 2.2rem; padding: 8px 0; padding: 0.8rem 0;
is valid css , how many combination of values allow single attribute.
it's give fallback older browsers.
a modern browser first apply "22px" line-height, overwrite "2.2rem" line-height. old browser apply "22px", won't understand "2.2rem" , won't utilize it.
this utilize rem values, or background linear-gradient, example.
ps: note don't need prefixes box-shadow or border-radius anymore. ;)
html css css3
Comments
Post a Comment