Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Css intro


Published on

  • Be the first to comment

  • Be the first to like this

Css intro

  1. 1. Layout (CSS)<br />Cascading Style Sheets<br />
  2. 2. What is CSS?<br />CSS stands for Cascading Style Sheets<br />Styles define how to display HTML elements<br />Styles were added to HTML 4.0 to solve a problem<br />External Style Sheets can save a lot of work<br />External Style Sheets are stored in CSS files<br />
  3. 3. CSS Saves a Lot of Work!<br />CSS defines HOW HTML elements are to be displayed.<br />Styles are normally saved in external .css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file!<br />
  4. 4. CSS Syntax<br />A CSS rule has two main parts: a selector, and one or more declarations:<br />The selector is normally the HTML element you want to style.<br />Each declaration consists of a property and a value.<br />The property is the style attribute you want to change. Each property has a value.<br />
  5. 5. CSS Comments<br />Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers.<br />A CSS comment begins with "/*", and ends with "*/", like this:<br />/*This is a comment*/p{text-align:center;/*This is another comment*/color:black;font-family:arial;}<br />
  6. 6. CSS is the better half of HTML. And in coding, there is no equality of status: HTML takes care of the rough stuff (the structure), while CSS gives it a nice touch (layout).<br />
  7. 7. One of the smart features of CSS is the possibility to manage your layout centrally. Instead of using the style attribute in each tag, you can tell the browser once how it must layout all the text on the page:<br />
  8. 8. <html> <br /><head> <br /><title>My first CSS page</title> <br /> <style type="text/css"> <br /> h1 {font-size: 30px; font-family: arial;} <br /> h2 {font-size: 15px; font-family: courier;} <br /> p {font-size: 8px; font-family: "times new roman";} <br /></style><br /></head> <br /><body> <br /><h1>My first CSS page</h1> <br /><h2>Welcome to my first CSS page</h2><br /><p>Here you can see how CSS works </p><br /></body> <br /></html> <br />
  9. 9. What else can I do with CSS?<br />CSS can be used for much more than specifying font types and sizes. For example, you can add colours and backgrounds. Here are some examples for you to experiment with.<br />
  10. 10. <p style="color:green;">Green text</p> <br /><h1 style="background-color: blue;">Heading on blue background</h1> <br /><body style="background-image: url('');"> <br />
  11. 11. Is CSS nothing but colours and font types?<br />CSS can also be used to control the page setup and presentation (margins, float, alignment, width, height etc.). By regulating the different elements with CSS you are able to layout your pages elegantly and precisely.<br />
  12. 12. <p style="padding:25px;border:1px solid red;">I love CSS</p><br />Result<br />I Love CSS<br />
  13. 13. With the property float an element can either be floated to the right or to the left.<br /><imgsrc="bill.jpg" alt="Bill Gates" style= "float:left;" /> <br /><p>Loremipsumdolor sit amet, consectetueradipiscingelit, seddiamnonummynibheuismodtinciduntutlaoreetdolore magna aliquameratvolutpat. Utwisienim ad minim veniam, quisnostrudexercitationullamcorpersuscipitlobortisnislutaliquip ex ea commodoconsequat...</p> <br />