CS174
Chris Pollett
Sep 14, 2020
<textarea name="life" rows="3" cols="40" > You can enter your life story here. </textarea>
<p style="color:red;">red paragraph</p>
<link rel="stylesheet" type="text/css" href="mystyles.css" />
Which of the following statements is true?
<link rel="icon" href="http://www.cs.sjsu.edu/faculty/pollett/favicon.ico" />
<tag style="property_1: value1 ; property2: value2; ..." >
<style > /* here is a comment */ rule_list </style>
selector {property_1: value1 ; property2: value2; ...}
h1 {font-size: 24pt;} /* would apply to all h1 tags in the document */ h2, h3 {font-size: 14pt;} /* notice applies to both h2 and h3 tags */
You can also specify that styles should only apply to elements in certain positions within the file:
body b i {font-size: 30pt;} /* only for bolded italic'd text within body of HTML*/
p.normal {prop_list1} p.narrow {prop_list2}
<p class="normal">normal look text</p>
.red {color:red}
<h3 class="red"></h3> <p class="red"></p>
p#sec1 {prop_list2}To use this we do:
<p id="sec1">section1 text</p>
input:hover {color:red} /* input tag will turn red when mouse over. */ input:focus {color:green} /* when click into input field, it will turn green */
<style"> div:first-child b { color:blue } div:before { content:"The following div tag has something to tell you: "; } </style> <div> <div> <b>I'm blue</b> </div> <div> <b>But I'm not</b> </div> </div>
rgb(0, 0, 0) /*decimal */ #C8C8C8 /*hex */