.outline { border: 1px solid #cccccc; }
The KU site-wide style sheet contains many internal comments, often used to label topical sections of the style sheet./* This text is a comment and will be ignored by the web browser. */
The spacing is not critical, but the punctuation is very important. Without the { }, colons, and semicolons in the right places, the style sheet will not be read correctly by the web browser. There are a few minor variations to this basic directive which will be covered later in this document.thing_to_modify { property: setting; property: setting; property: setting; }
The "h1" at the beginning of the { } block tells the web browser that all the properties within that { } block describe how all <H1> text should look. Any HTML tag descriptor can be modified in this way. The KU Style Sheet has specifications for many of the basic HTML tags including H1 through H6, the anchor tag <a href="">, and others.h1 { color: #666666; font-size: 19px; font-weight: 400; padding: 0px 0px 0px 0px; margin: 10px 0px 0px 0px; }
body { font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 17px; color: #666666; text-align: center; margin: 0; padding: 0; background-color: #FFFFFF; }
allows the class name "redtext" to be used to modify text in the web page:.redtext { color: #f66666; }
producing web content that looks like this:<p class="redtext"> This is a red paragraph. </p>
This is a red paragraph
As a refinement, style sheets also allow a class to be attached only to a specific tag. By using the style declaration "p.redtext { ... }", the "redtext" class will only be usable by the <p> tag. If the class name is non-specific (like ".redtext { ... }"), the class can be used in nearly any tag:Now that individual paragraph can be modified with the style sheet using this syntax:<p id="first_paragraph"> This is the first paragraph on the page, so it needs special treatment. </p>
When the HTML code is displayed in the browser, the #first_paragraph style will be applied, making it look like this:#first_paragraph { font-size: 1.2em; border: 1px solid #cccccc; }
This is the first paragraph on the page, so it needs special treatment.
Using IDs can be very useful, but be careful to never re-use an ID. The browser expects an ID to appear only once on a web page. Any more than that is an error, and will produce unpredictable results.You can think of the DIV tag as creating a DIVision of the web page. Used on its own, it has very little impact on the page contents. The DIV tag is rarely used on its own, however. Usually, it's used as a way to establish a region of the page which should use a certain Style (a class or ID) from the style sheet. When the DIV is used this way, it's almost like creating a table in HTML, but the DIVs are used in place of the TD tags from the table. There are no tags which define rows or columns, as such. Instead, the style sheet is used to govern how much space a given DIV should use in the page.<div> ... </div>
The DIV tag can be used to give you much more specific control over different parts of the page by simply applying a style Class or ID to the div. For example, this style can be used to make the contents of a DIV appear in a box on the left, with all text inside in italics:<html> <body> <div> First div. </div> <div> Second div. </div> <div> Third div. </div> </body> </html>
In action, the DIV looks like this:.boxleft { width: 100px; border: 1px solid #cccccc; float: left; font-style: italic; margin-right: 4px; }
font-family: Arial, Helvetica, sans-serif;
font-size:
Set the size of the font. This can be in pixels ("px"), points ("pt"), or "em". "em" is
a unit which sets the font-size relative to the default, so "1.0em" is "same size as default"
and "1.4em" is "1.4 times the size of the default".
font-size: 11px; /* absolute setting */ font-size: 1.2em; /* relative setting */
color:
Set the color of the text. This is given in the HTML standard #...... form
color: #666666; /* medium grey */
text-align:
Set the horizontal alignment of the text. Possible values are "left", "right", and "center".
text-align: left;
vertical-align:
Set the vertical alignment of the text. Common values are "top", "bottom", "baseline", "middle".
vertical-align: top;
font-weight:
Set the thickness of the text. This is how style sheets make boldface text. Column values
are "bold" and "normal".
font-weight: bold;
font-style:
Set the style of the text. This is how style sheets make italic text. Common values are
"normal" and "italic".
font-style: italic;
text-decoration:
Set text decoration. The most common choices are "none" and "underline".
text-decoration: none;
margin:
Set the spacing around the outside of the object. The units can be given in pixels, percentage,
or "em".
margin-top: 10px; /* absolute value */ margin-right: 5%; /* relative to the size of the HTML object */ margin-bottom: 6px; /* absolute value */ margin-left: 1.0em; /* relative to the size of the font */
padding:
Set the spacing within the bounds of the object. The distinction between "margin" and "padding"
can be most clearly seen in objects with borders. The difference
is illustrated in w3.org's CSS reference.
The units are the same as with "margin" above.
padding-top: 10px; /* absolute value */ padding-right: 5%; /* relative to the size of the HTML object */ padding-bottom: 6px; /* absolute value */ padding-left: 1.0em; /* relative to the size of the font */
width:
Set the width of the HTML object. This can be given in pixels, percentage, and "em".
width: 100%; /* relative to the surrounding HTML element */ width: 200px; /* absolute value */
height:
Set the height of the HTML object. This can be given in pixels, percentage, and "em".
height: 100%; /* relative to the surrounding HTML element */ width: 200px; /* absolute value */
border:
Set the entire object border in one line. The setting can be "none" or a full border
specification.
border: none; border: 1px solid #cccccc; /* thickness, style, color */
border-top: (and others)
Set a single border edge. The setting can be "none" or a full border
specification.
border-top: none; border-top: 1px solid #cccccc; /* thickness, style, color */ border-right: 1px solid #cccccc; border-bottom: 1px solid #cccccc; border-left: 1px solid #cccccc;
