1 / 19

End User Computing

More on HTML and CSS. Sujana Jyothi Department of Computer Science sujana@cs.nuim.ie. End User Computing. Recap. Monday 1 st February 2010: Introduction to HTML Wednesday 3 rd February 2010: Introduction to simple styling using CSS

Download Presentation

End User Computing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. More on HTML and CSS • Sujana Jyothi • Department of Computer Science • sujana@cs.nuim.ie End User Computing

  2. Recap • Monday 1st February 2010: Introduction to HTML • Wednesday 3rd February 2010: Introduction to simple styling using CSS • Today: Positioning objects in a webpage and how to divide a page into sections. End User Computing

  3. Positioning in CSS • If you want a picture or a section to be on the left or right hand side of a page, you set it to “float” right (or left). • To further control positioning you can use “margins”. • Let’s try an example End User Computing

  4. Float Example • Task: Move an image to the left of the page and have some text displayed alongside it. img { float: left; } End User Computing

  5. Float Example • Move an image to the right hand side of the page and have text displayed alongside: it. img { float: right; margin: 20px 15px 15px 15px; } Margin: T-R-B-L (trouble)‏ Simple_html End User Computing

  6. Float Example • Let us begin to build our page: • Put a background colour • Some more text • A list • Start_example.html • Example.css

  7. Menu Example • A Menu is generally just a list of links • li • { • margin: 0px 0px -5px -40px; • padding: 4px 3px 4px 12px; • width: 180px; • color: #4169E1; • list-style-type: none; • } Margin: T-R-B-L (trouble)‏ End User Computing

  8. Menu Example • li • { • display: block; • margin: 0px 0px -5px -40px; • padding: 4px 3px 4px 12px; • width: 180px; • color: #4169E1; • border-bottom: 1px solid #efefef; • list-style-type: none; • } End User Computing

  9. Dividing a page into sections There are HTML tags called div's which are used to divide a page into different sections: <div> <p> Example text </p> </div> This makes development go much faster and allows you to create a template of each webpage very easily. These div's can then be styled in CSS to be positioned in a certain area of the page or to have a certain width or height and so on. End User Computing

  10. Dividing a page into sections Header Menu Left Content Menu Footer End User Computing

  11. In HTML <div id="header"> <img src="i/nuim_crest.gif">..... </div> <div id="content"> Hi I'm ..... </div> <div id="lefty"> <div id="menu"> <ol><li>Home</li>....</ol> </div> Holography.... </div> <div id="footer"> Home... </div> End User Computing

  12. The “id” Sections of your webpage can be styled in CSS, this is done using id's. Each section can reference an id which is styled in CSS but each id must be UNIQUE in the CSS. So for example you can style links in a menu with blue text, and links in the main content page with orange text. Or you can have a paragraph with normal sized text and a paragraph with large text. End User Computing

  13. id Example <p> This is a normal paragraph with normal text </p> <p id="LargeIntro"> This is a paragraph where the font size has been changed to a larger text. </p> p { font-size: 12px; } p#LargeIntro { font-size: 24px; } End User Computing

  14. Develop a page from scratch: Part 1 • So now I'm going to show you how to develop a simple page from scratch using CSS and HTML. • If at any stage you don't understand what I've done or want a more thorough explanation just stop me and ask. End User Computing

  15. Dividing the site Final_example.html example.css End User Computing

  16. Dividing the site Inside the <body> we will have the division: 1) main Inside main we will have the divisions: i) header ii) content iii) menu example.html example.css End User Computing

  17. Final result End User Computing

  18. Recap • Ok, so we've covered today some of the ways you can position things with CSS (using floats/margins/padding). • We've seen how a page can be broken down into sections using divisions • This was a lot to cover in one lecture, on Monday we will be going through some more advanced CSS and using this we will finish off creating a homepage. End User Computing -- 7th February 2008

More Related