180 likes | 353 Views
CSS. An introduction to css. What is CSS?. CSS stands for “cascading style sheets” Is a different language from HTML Controls the presentation of the HTML. Where does CSS fit in?. HTML. CSS. Why use CSS?.
E N D
CSS An introduction to css
What is CSS? CSS stands for “cascading style sheets” Is a different language from HTML Controls the presentation of the HTML
Where does CSS fit in? HTML CSS
Why use CSS? After it loads once it can be cached in local memory, thus making your website load faster It streamlines the job of the designer (you) for quicker edits/updates of presentation And many more reasons
What can you control • Anything dealing with appearance • Font • Font color • Font size • Alignment of objects
Types of Style sheets • External style sheets • Stored as a .css file • Best if you have multiple pages in your website and they all should look the same • Internal style sheets • Written in the <head> section of a webpage • Written within the <style> </style> tag element • Over-rides an external styles • Inline styles • Written within any html tag element • Over-rides both external and internal styles
Organizing a stylesheet • Cascading Style Sheets should be stored in a folder called “styles” • The file name should end with the .css extension
Linking to a stylesheet • New HTML tag • link • New Attributes • href---Where is the document • rel---What is the document relative to • type---What type of document is it • media---How is the object used <link href="styles/style-portfolio.css" rel="stylesheet" type="text/css" media="screen" />
How to write a rule for a tag • A rule for a tag is written in the following way • Selector-The html element • Declaration-The property and value you declare • Property-The style attribute you want to change • Value-What you want to property to be h1 { color: #000000; text-align: center; font-size: 15px; }
How to write a rule for an id selector • A rule for an id selector is written in the following way: • Selector- written by putting a # in front of the id name • Declaration-The property and value you declare • Property-The style attribute you want to change • Value-What you want to property to be #header { width: 800px; height:250 px; background-color:#000000; }
How to write a rule for an CLASS selector • A rule for an class selector is written in the following way: • Selector- written by putting a . in front of the class name • Declaration-The property and value you declare • Property-The style attribute you want to change • Value-What you want to property to be .picture { float:right; }
Tips When choosing a font family, use Microsoft Word to pick a font you like. When choosing a color, use the color picker from Fireworks