CS174
Chris Pollett
Sep 14, 2022
selector { property_1:value_1; ... property_n:value_n; }For example,
h1 { font-size:20pt; // make the font-size for h1 tags 20pt=20/72inches tall }
body {background-image: url(background.jpg);}
<style type="text/css"> p.first {position: absolute; top:1in; left:2in;} p.second {position: relative; left:-1in;} </style> <p class="first">displays one inch down two inches from left of top of screen</p> <p class="second">displays 1inch to the left of where the first paragraph finished</p>
<input type="text" name="fname" accesskey="f" />
select { font-size: 2in; }
<style> .hidden-div { display: none; } .focus-test { font-size:.6in; } .focus-test:focus-within .hidden-div { display:block; } </style> <div class="focus-test"> <a href="">Nothing to see here.</a> <div class="hidden-div"> Whoa! Big reveal! In Safari, would need to add tabindex="1" to focus-test div tag </div> </div>