CSCI 2133
CSCI 2133 – Rapid Programming Techniques for Innovation
UI Design – CSS Grid and Flexbox
CSCI 2133 Rapid Programming Techniques for Innovation UI Design - - PowerPoint PPT Presentation
CSCI 2133 Rapid Programming Techniques for Innovation UI Design CSS Grid and Flexbox CSCI 2133 2 Previous Lecture CSS / CSS3 SASS / SCSS CSCI 2133 CSS Layout 3 CSCI 2133 CSS Layout Whats a layout?
CSCI 2133
UI Design – CSS Grid and Flexbox
CSCI 2133
2
CSCI 2133
3
CSCI 2133
S Sgrids
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
CSCI 2133
bothmergedrows&columns
CSCI 2133
CSCI 2133
Logo Navigation bar Headline ain Content Footer Side Col
CSCI 2133
CSCI 2133
CSCI 2133
24
https://www.websitebuilderexpert.com/designi ng-websites/awesome-home-page-design- layouts/ (But do not trust advertising on this page) https://www.w3schools.com/css/css_website_l ayout.asp
CSCI 2133
Credit to W3school
25
CSCI 2133
.header { background-color: #F1F1F1; text-align: center; padding: 20px; }
CSCI 2133
/* The navbar container */ .topnav {
background-color: #333; } /* Navbar links */ .topnav a { float: left; display: block; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; } /* Links - change color on hover */ .topnav a:hover { background-color: #ddd; color: black; }
CSCI 2133
28
CSCI 2133
29 /* Create three equal columns that floats next to each other */ .column { float: left; width: 33.33%; } /* Clear floats after the columns */ .row:after { content: ""; display: table; clear: both; } /* Responsive layout - makes the three columns stack on top of each other instead of next to each other on smaller screens (600px wide or less) */ @media screen and (max-width: 600px) { .column { width: 100%; } }
CSCI 2133
30
.footer { background-color: #F1F1F1; text-align: center; padding: 10px; }
CSCI 2133
https://web.cs.dal.ca/~gang/csci2133-project/layout-demo/
31
CSCI 2133
CSCI 2133
CSCI 2133
.flexbox { display: flex; }
CSCI 2133
Then,youcandistributespace aroundorbetweenitemsusing justify-content
.flexbox { justify-content: space-around; }
CSCI 2133
.flexbox { justify-content: space-between; }
CSCI 2133
.flexbox { align-items: center; }
CSCI 2133
.fixed-item { flex: 0 0 25%; }
CSCI 2133
.growing-item{ flex-grow: 1; }
CSCI 2133
.flexbox { flex-wrap: wrap; }
CSCI 2133
41
CSCI 2133
42
.login-container {
display: flex; width: 750px; height: 1334px; padding: 0; margin: 0; list-style: none; flex-direction: column; justify-content: flex-start; align-items: center;
}
CSCI 2133
CSCI 2133
CSCI 2133
“ I startrow 1 and take1 row I startcolumn1 and take2 columns“
CSCI 2133
“ I startrow 1 and take3 rows I startcolumn3 and take1 column“
CSCI 2133
47
CSCI 2133