csci 2133 rapid programming techniques for innovation
play

CSCI 2133 Rapid Programming Techniques for Innovation CSS, CSS3, - PowerPoint PPT Presentation

CSCI 2133 Rapid Programming Techniques for Innovation CSS, CSS3, SASS/SCSS CSCI 2133 2 Previous Lecture HTTP 1/2 HTML / HTML5 CSCI 2133 H T M L 5O V E R V I E W HTML5 is the new standard, which includes: New HT


  1. CSS Background CSS background properties are used to define the background • effects of an element . background-color sets the background color of an element • background-image sets the background image for an element • background-repeat sets how a background image will be • repeated background-attachment sets whether a background image is • fixed or scrolls with the rest of the page CSCI 2133

  2. CSS Background CSS background properties are used to define the background • effects of an element . background-color sets the background color of an element • background-image sets the background image for an element • background-repeat sets how a background image will be • repeated background-attachment sets whether a background image is • fixed or scrolls with the rest of the page background-position sets the starting position of a background • image CSCI 2133

  3. CSS Background CSS background properties are used to define the background • effects of an element . background-color sets the background color of an element • background-image sets the background image for an element • background-repeat sets how a background image will be • repeated background-attachment sets whether a background image is • fixed or scrolls with the rest of the page background-position sets the starting position of a background • image background sets all the background properties in one declaration • CSCI 2133

  4. CSS Background CSS background properties are used to define the background • effects of an element . background-color sets the background color of an element • background-image sets the background image for an element • background-repeat sets how a background image will be • repeated background-attachment sets whether a background image is • fixed or scrolls with the rest of the page background-position sets the starting position of a background • image background sets all the background properties in one declaration • CSCI 2133

  5. CSS Positioning CSCI 2133

  6. CSS Positioning The CSS positioning properties allow you to position an • element. CSCI 2133

  7. CSS Positioning The CSS positioning properties allow you to position an • element. Elements can be positioned using the top , bottom , left , and • right properties. CSCI 2133

  8. CSS Positioning The CSS positioning properties allow you to position an • element. Elements can be positioned using the top , bottom , left , and • right properties. position:static is the default position of an element • CSCI 2133

  9. CSS Positioning The CSS positioning properties allow you to position an • element. Elements can be positioned using the top , bottom , left , and • right properties. position:static is the default position of an element • position:fixed tells an element to be positioned relative to the • browser window . It will not move even if the window is scrolled CSCI 2133

  10. CSS Positioning The CSS positioning properties allow you to position an • element. Elements can be positioned using the top , bottom , left , and • right properties. position:static is the default position of an element • position:fixed tells an element to be positioned relative to the • browser window . It will not move even if the window is scrolled position:relative tells an element to be positioned relative to • its normal position . CSCI 2133

  11. CSS Positioning The CSS positioning properties allow you to position an • element. Elements can be positioned using the top , bottom , left , and • right properties. position:static is the default position of an element • position:fixed tells an element to be positioned relative to the • browser window . It will not move even if the window is scrolled position:relative tells an element to be positioned relative to • its normal position . position:absolute tells an element where to be positioned • relative to its parent element . CSCI 2133

  12. {position:static;} {position:static;} CSCI 2133

  13. {position:static;} {position:static;} CSCI 2133

  14. {position:static;} {position:static;} {position:static;} {position:fixed;} CSCI 2133

  15. {position:static;} {position:static;} {position:static;} {position:fixed;} CSCI 2133

  16. {position:static;} {position:static;} {position:static;} {position:fixed;} {position:relative;} {position:absolute;} CSCI 2133

  17. {position:static;} {position:static;} {position:static;} {position:fixed;} {position:relative;} {position:absolute;} CSCI 2133

  18. CSS Float CSCI 2133

  19. CSS Float With CSS float, an element can be pushed to the • left or right , allowing other elements to wrap around it. CSCI 2133

  20. CSS Float With CSS float, an element can be pushed to the • left or right , allowing other elements to wrap around it. clear Specifies which sides of an element where • other floating elements are notallowed . CSCI 2133

  21. CSS Float With CSS float, an element can be pushed to the • left or right , allowing other elements to wrap around it. clear Specifies which sides of an element where • other floating elements are notallowed . float Specifies whether or not a box should float • to the left or right . CSCI 2133

  22. CSS Float img {float:none;} CSCI 2133

  23. CSS Float img {float:none;} img {float:left;} CSCI 2133

  24. CSS Float img {float:none;} img {float:left;} img {float:right;} CSCI 2133

  25. CSS Float img {float:none;} • Vivamus dignissim nunc eleifend, commodo mi sed, aliquam ante. Donec id lacus eu lectus sollicitudin viverra. Curabitur congue ultricies elit, at euismod mauris iaculis at. Sed et dignissim ipsum. Quisque massa quam, lacinia vel urna ac, dictum lobortis justo.“ Donec et molestie img {float:left;} img {float:right;} CSCI 2133

  26. CSS Float img {float:none;} • Vivamus dignissim nunc eleifend, commodo mi sed, aliquam ante. Donec id lacus eu lectus sollicitudin viverra. Curabitur congue ultricies elit, at euismod mauris iaculis at. Sed et dignissim ipsum. Quisque massa quam, lacinia vel urna ac, dictum lobortis justo.“ Donec et molestie • Vivamus dignissim nunc eleifend, commodo mi sed, aliquam ante. Donec id lacus eu lectus sollicitudin viverra. Curabitur congue ultricies elit, at euismod mauris iaculis img {float:left;} at. Sed et dignissim ipsum. Quisque massa quam, lacinia vel urna ac, dictum lobortis justo.“ Donec et molestie • purus ”. Cras et faucibus est, a viverra odio. Praesent luctus vel purus non mollis. In luctus vitae lectus quis fringilla. Curabitur porttitor justo ac dolor iaculis convallis. img {float:right;} CSCI 2133

  27. CSS Float img {float:none;} • Vivamus dignissim nunc eleifend, commodo mi sed, aliquam ante. Donec id lacus eu lectus sollicitudin viverra. Curabitur congue ultricies elit, at euismod mauris iaculis at. Sed et dignissim ipsum. Quisque massa quam, lacinia vel urna ac, dictum lobortis justo.“ Donec et molestie • Vivamus dignissim nunc eleifend, commodo mi sed, aliquam ante. Donec id lacus eu lectus sollicitudin viverra. Curabitur congue ultricies elit, at euismod mauris iaculis img {float:left;} at. Sed et dignissim ipsum. Quisque massa quam, lacinia vel urna ac, dictum lobortis justo.“ Donec et molestie • purus ”. Cras et faucibus est, a viverra odio. Praesent luctus vel purus non mollis. In luctus vitae lectus quis fringilla. Curabitur porttitor justo ac dolor iaculis convallis. • Vivamus dignissim nunc eleifend, commodo mi sed, aliquam ante. Donec id lacus eu lectus sollicitudin viverra. Curabitur congue ultricies elit, at euismod mauris iaculis img {float:right;} at. Sed et dignissim ipsum. Quisque massa quam, lacinia vel urna ac, dictum lobortis justo.“ Donec et molestie • purus ”. Cras et faucibus est, a viverra odio. Praesent luctus vel purus non mollis. In luctus vitae lectus quis fringilla. Curabitur porttitor justo ac dolor iaculis convallis. CSCI 2133

  28. CSS Display and Visibility CSCI 2133

  29. CSS Display and Visibility • The display property specifies if/how an element is displayed, and the visibility property specifies if an element should be visible or hidden. CSCI 2133

  30. CSS Display and Visibility • The display property specifies if/how an element is displayed, and the visibility property specifies if an element should be visible or hidden. visibility:hidden hides an element, but it will still take up • the same space asbefore. CSCI 2133

  31. CSS Display and Visibility • The display property specifies if/how an element is displayed, and the visibility property specifies if an element should be visible or hidden. visibility:hidden hides an element, but it will still take up • the same space asbefore. display:none hides an element, and it will not take up any • space. CSCI 2133

  32. CSS3 Quick Views Box shadow, text shadow Media Types Font face _____________________ Opacity -- demo Border radius -- demo Gradients -- demo CSCI 2133

  33. C S S Image Opacity / Transparency CSCI 2133

  34. C S S Image Opacity / Transparency • The CSS3 property for transparency is opacity . CSCI 2133

  35. C S S Image Opacity / Transparency • The CSS3 property for transparency is • opacity . The opacity property can take a value from 0.0 - 1.0. A lower value makes the element more transparent . {opacity:0.1;} {opacity:0.5;} {opacity:1.0;} CSCI 2133

  36. C S S Media Types • By using the @media rule, a website can have a different layout for screen , print , mobile phone , tablet , etc. CSCI 2133

  37. C S S Media Types By using the @media rule, a website can have a • different layout for screen , print , mobile phone , tablet , etc. all Used for all media type devices • CSCI 2133

  38. C S S Media Types By using the @media rule, a website can have a • different layout for screen , print , mobile phone , tablet , etc. all Used for all media type devices • print Used for printers • • CSCI 2133

  39. C S S Media Types By using the @media rule, a website can have a • different layout for screen , print , mobile phone , tablet , etc. all Used for all media type devices • print Used for printers • screen Used for computer screens • • CSCI 2133

  40. C S S Media Types By using the @media rule, a website can have a • different layout for screen , print , mobile phone , tablet , etc. all Used for all media type devices • print Used for printers • screen Used for computer screens • tv Used for television-type devices • • CSCI 2133

  41. Good Example credit t to w3 w3school • Change the background color of the <body> element to "lightblue" when the browser window is 600px wide or less: @media only screen and (max-width: 600px) { body { background-color: lightblue; } } • You can also have different stylesheets for different media, like this: <link rel="stylesheet" media="screen and (min-width: 900px)" href="widescreen.css"> <link rel="stylesheet" media="screen and (max-width: 600px)" href="smallscreen.css"> 92 CSCI 2133

  42. Box Shadow with Inside/Outside 93 CSCI 2133

  43. Blend Mode There is also: screen , overlay , darken , lighten , color-dodge , color- burn , hard-light , soft-light , difference , exclusion , hue , saturation , color , and luminosity . And also normal which reset it. 94 CSCI 2133

  44. Open Font face • “The @font-face rule allows custom fonts to be loaded on a webpage. Once added to a stylesheet, the rule instructs the browser to download the font from where it is hosted, then display it as specified in the CSS.” • - Quoted from “css-tricks.com” 95 CSCI 2133

  45. Font Face Usage • Definition: @font-face { font-family: 'MyWebFont’; src: url('myfont.woff2') format('woff2’), url('myfont.woff') format('woff’); } • How to use: @import url(//fonts.googleapis.com/css?family=Open+Sans); body { font-family: 'Open Sans', sans-serif; } 96 CSCI 2133

  46. What is S A S S ? CSCI 2133

  47. What is S A S S ? • SASS stands for Syntactically Awesome Style Sheets CSCI 2133

  48. What is S A S S ? SASS stands for Syntactically Awesome Style Sheets • Sass is a C S S preprocessor • CSCI 2133

  49. What is S A S S ? SASS stands for Syntactically Awesome Style Sheets • Sass is a C S S preprocessor • Sass can be written in either the sass or scss syntax • CSCI 2133

Recommend


More recommend