1 / 12

CS110: Computers and the Internet

CS110: Computers and the Internet. Box Model, Layout. Today. CSS Box Model Using Firebug Layout Centering inline and block elements Float Two-Colum layout. CSS Box Model. p { color: maroon; background-color: pink; width: 200px; padding: 20px;

tameka
Download Presentation

CS110: Computers and the Internet

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. CS110: Computers and the Internet Box Model, Layout

  2. Today • CSS Box Model • Using Firebug • Layout • Centering inline and block elements • Float • Two-Colum layout

  3. CSS Box Model p { color: maroon; background-color: pink; width: 200px; padding: 20px; border: 5px dashed blue; margin: 50px; } margin padding width box content border The top, bottom, left and right sides of the margin, padding and border can be styled differently, to create many distinct appearances

  4. Exploring the the Box Model with Firebug • http://cs.wellesley.edu/~cs110/lectures/BoxModel/box-ex1.html

  5. Centering Inline Content

  6. Centering Inline Content (2)

  7. Centering Block Elements

  8. Centering Images

  9. Floats and Flow • By default, blocks on a page, or within another block, are arranged on the page from top to bottom. • The Flow is the normal top-to-bottom mechanism. • Elements can be removed from the flow using the CSS property float • Both inline and block elements can float

  10. CSS Float Example: IntroCS4 • http://cs.wellesley.edu/~cs110/lectures/CSS_example/CSSlayout/introCS4.html • Styled navigation bar • Floating pictures and navigation bar

  11. CSS Two-Columns Example • http://cs.wellesley.edu/~cs110/lectures/CSS_example/CSSlayout/introCS4navleft.html • The border around the navigation bar is removed • Background color of the body is set to the same light blue as the navigation bar • New mainContet Div is create with large enough left margin

  12. CSS Example: Boxes • http://cs.wellesley.edu/~cs110/lectures/CSS_example/CSSlayout/introCSfinal.shtml • This page uses a fixed layout - the navigation bar and block of introductory material both have fixed widths. • A course div surrounds each course description and has a smaller font, narrower width, and is floated to the left • The mainContent div surrounds the four course descriptions and additional course information near the bottom of the page. • Both the mainContent and info div's include clear: both; in their style so that there is a clean separation between these div's and previous page contents. • Finally, some styling for the footer material is placed inside a footer div in the external style sheet.

More Related