la layou out an and gr grids
play

La Layou out an and Gr Grids No screens Prof. Lydia Chilton - PowerPoint PPT Presentation

La Layou out an and Gr Grids No screens Prof. Lydia Chilton COMS 4170 24 January 2018 COMS 4170 Goal 1 Build websites that suit the needs and abilities of users The main goal of many websites is to display information users need. Layout


  1. La Layou out an and Gr Grids No screens Prof. Lydia Chilton COMS 4170 24 January 2018

  2. COMS 4170 Goal 1 Build websites that suit the needs and abilities of users The main goal of many websites is to display information users need.

  3. Layout in HTML How to construct the layout of information in HTML and CSS

  4. Today’s goal: layout in HTML and CSS Remake this in informatio ion la

  5. “I finished coding up my website…” “It just doesn’t work yet!”

  6. tive Style of Programming It Iter erativ What’s the most basic thing I can do to make necessary progress towards my goal? Goal Iteration <html> <body> Hello world! </body> </html> Does it look ok?

  7. Step 0. Make a html page, connect some CSS

  8. List 20 things we could we do first.

  9. Make a container div

  10. What next?

  11. Container div has realistic width.

  12. What next?

  13. Blue facebook header

  14. What next?

  15. Blue facebook header

  16. What next?

  17. Add the first post

  18. What next?

  19. Add internal structure to the first post

  20. By default, DIV elements will flow down the page. display: block To get them to flow across the page, you must set display: inline-block

  21. What next?

  22. Add padding on the top post

  23. What next?

  24. Replies

  25. What next?

  26. Reply substructure: image and text

  27. What next?

  28. Reply Container positioning

  29. What next?

  30. Reply Class background-color

  31. Reduce Reply Text Width

  32. What next? Am I done?

  33. Reply Text is longer

  34. Reply Text height fixed

  35. Remove borders

  36. NA NAIL ILED D IT IT!

  37. After layout… what next?

  38. tive Style of Programming It Iter erativ What’s the most basic thing I can do to make substantial progress towards my goal? <html> <body> Hello world! </body> </html> Does it look ok?

  39. Iterative Style of Programming helped me recover from errors one at a time (as I created them) Error 2: reply div padding Error 3: Reply div height Error 1: display inline-block

  40. Grids Currently the dominant way to layout information

  41. Many sites use grids to layout the major sections of information.

  42. Before: Now: Grids Symmetric Layout Asymmetric Layout

  43. The Bauhaus School of Design

  44. Jan Tschichold: inspired by clean designs of the Bauhaus school

  45. Basic Architecture of a grid: * The grid has columns

  46. Basic Architecture of a grid: * The grid has columns * Rows lay out information vertically. * Within each row, divs can span multiple columns

  47. Basic Architecture of a grid: The grid has columns • Rows lay out information • vertically. Within each row, divs can • span multiple columns Next grids of 12 columns • within a grid.

  48. Implementing Grids on the Web: Twitter Bootstrap

  49. Add Bootstrap to your HTML CSS & JS in <head> tag, before your own CSS

  50. Bo Bootstrap gri rid . How many columns?

  51. Example <div class=“container"> <div class="row"> <div class=“ col col-md md-3 ”> <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col-md md-3 ”> <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col-md md-3 ”> <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col-md md-3 ”> <img src="./hci-square.png" class="img img-responsive"> </div> </div> </div>

  52. Note: you can omit the number for even distribution. <div class=“container"> <div class="row"> <div class=“ col col ”> <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col ”> <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col ”> <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col ”> <img src="./hci-square.png" class="img img-responsive"> </div> </div> </div>

  53. Example 2 <div class=“container"> <div class="row"> <div class= “col-md-2” > <img src="./hci-square.png" class="img img-responsive"> </div> <div class= “col-md-2” > <img src="./hci-square.png" class="img img-responsive"> </div> <div class= “col-md-4” > <img src="./hci-square.png" class="img img-responsive"> </div> <div class= “col-md-4” > <img src="./hci-square.png" class="img img-responsive"> </div> </div> </div>

  54. How would you create this?

  55. A nested row <div class="row"> <div class="col-md-4"> <img src="./hci-square.png" class="img img-responsive"> </div> <div class="col-md-4"> <div class="row"> <div class="row"> <div class="col <div class="col-md md-3"> 3"> <p>Hamlet</p> <p>Hamlet</p> </div> </div> <div class="col <div class="col-md md-9"> 9"> <p>Tomorrow and tomorrow...</p> <p>Tomorrow and tomorrow...</p> </div> </div> </div> </div> <div class="row"> <div class="col-md-3"> <p>Hamlet</p> </div> ...

  56. Responsive Design

  57. 4 Device sizes Extra small devices (less than 768px) */ /* Extra small devices Phones @media (max-width: 768px) { #logo { color: yellow; } } Tablets /* Small devices Small devices (768px and up) */ @media (min-width: 768px) { #logo { color: red; } } /* Medium devices Medium devices (992px and up) */ Laptops @media (min-width: 992px) { #logo { color: blue; } } /* Large devices Large devices (1200px and up) */ Large desktops @media (min-width: 1200px) { #logo { color: green; } }

  58. What will this do? <div class="row"> <div class=“ col xs-6 ”> col-md md-3 col 3 col-xs <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col xs-6 ”> col-md md-3 col 3 col-xs <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col xs-6 ”> col-md md-3 col 3 col-xs <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col-md md-3 col 3 col-xs xs-6 ”> <img src="./hci-square.png" class="img img-responsive"> </div> </div>

  59. What will this do on a phone? <div class="row"> <div class=“ col xs-6 ”> col-md md-3 col 3 col-xs <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col xs-6 ”> col-md md-3 col 3 col-xs <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col xs-6 ”> col-md md-3 col 3 col-xs <img src="./hci-square.png" class="img img-responsive"> </div> <div class=“ col col-md md-3 col 3 col-xs xs-6 ”> <img src="./hci-square.png" class="img img-responsive"> </div> </div>

  60. Two examples at xs-screen width class=“col-md-3” class=“col-md-3 col-xs-6”

  61. In summary…

  62. tive Style of Programming It Iter erativ What’s the most basic thing I can do to make substantial progress towards my goal? Iteration <html> <body> Hello world! </body> </html> Goal Does it look ok?

  63. Gr Grid ids are a modern layout architecture that help in ce through: indic icate im importan ance grouping, size, and location

  64. Announcements • Assignment 1 due tonight @ 11:59 • If you are on the waitlist, email me your UNI now (by 5:45) and I will add you to Courseworks as a non-registered students • chilton@cs.columbia.edu • Check that I have added you by 6pm. • People who do not turn in Assignment 1 will be dropped • People who turn in Assignment 1 will be added based on priority

Recommend


More recommend