CSS Special symbols in HTML and are special

CSS

Special symbols in HTML � < and > are special symbols with special meanings How would you display A < B ? Suggestions? � < for < and > for > & is an escape symbol, handled specially. Always ends with ; � Means that you need a special way to display “&” too: & � Good list at http: //www. utexas. edu/learn/html/spchar. html

Web Instructions: Three Legs HTML CSS Content Presentation Java. Script Behavior

CSS. . . CSS is for giving style to your content HTML: content CSS: style CSS Zen Garden

What can you change? � Font: size, color, style › More on color next week › For now, by name � Background � Border › Must have size color and style � Position: � Size margins, centering

Syntax (how it looks) Selector specifies the HTML element to style Declaration: always contains a property & value ends with a semicolon Property: style element you want to change Value: what you are changing the property to

Formatting your CSS Formatting Practices: some flexibility, but you must be consistent. always comment unclear code! /* some. Comment. Here */ curly braces tab alignment Bad practices: declarations on the same line as braces or selector multiple declarations on the same line leaving off the last semi-colon

Commonly Used Tags & Properties full reference sheet

Font Families � Preferable to use: universality � Multiple fonts: use first available

Defining size � pt refers to printer’s font measurement � px refers to pixels � em is a relative measure › 1 em = base size (defined in body or default) › Great for changing all at once

Page Structure

General Page Structure <!DOCTYPE html> <head> <! ---defining character necessary for validation --- > <meta charset="UTF-8"> <! --- what shows up on the tab --- > <title>Put your title here</title> </head> <body> <! --- the “good stuff” i--- > What will appear on the page </body> </html>

The Body � Every page needs › Header (DIFFERENT THAN head) › Content (Main) › Footer � Minimal content › Header: title › Footer: who wrote it and when

Dividing Up the Body Basic model: <header>…</header> Use for main title <main> … </main> Use for the main content <footer> … </footer> Use for accreditations and citations Each section can be formatted independently (soon)

Adding CSS to your HTML The best (only way for this class!) way to insert CSS to your HTML is by using an External Style Sheet Define all your styles in one place Easily change the look of your site Use the following <link> tag within the <head> tag Save your external style sheet as a. css file. <link href=“mystyle. css” rel=stylesheet type=“text/css”>

Another Tool Komodo Templates
- Slides: 16