70 likes | 242 Vues
CSS . 16 January 2014. CSS. CSS is for giving style to your content HTML: content CSS: style CSS Zen Garden. 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
E N D
CSS 16 January 2014
CSS... • CSS is for giving style to your content • HTML: content • CSS: style • CSS Zen Garden
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>
Everyone make a style sheet… • New HTML file in Komodo • New CSS file in Komodo (mystyle.css) • Link CSS file from HTML (in head section!) <link href=“mystyle.css” rel=“stylesheet”>
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! • /* someCommentHere */ • 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 ; • What does Komodo help you with? • drop downs • formats • syntax errors
Commonly Used Tags & Properties full reference sheet