Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSS & HTML - Code in one day

CSS & HTML - Code in one day

Code in One Day

Bill Patrianakos

January 09, 2016
Tweet

More Decks by Bill Patrianakos

Other Decks in Programming

Transcript

  1. BILL PATRIANAKOS Software Engineer & Full stack developer Founded a

    web design company Former CTO @ Aplo, LLC BEWD Instructor at General Assembly
  2. WHAT WE’LL COVER ➤ How the internet and websites work

    ➤ Fundamental HTML and CSS syntax and how to build web pages ➤ How to style a website and add interactivity using CSS and JavaScript ➤ How to organize front-end code ➤ Getting your website online
  3. WHAT CAN I DO WITH THESE SKILLS? ➤ These are

    the fundamental building blocks of the web ➤ Create landing pages or marketing emails ➤ Manage entries in a CMS or blogging system like Wordpress ➤ Design and code entire websites from scratch
  4. SETTING UP YOUR ENVIRONMENT ➤ Get a text editor ➤

    Sublime Text 3 is an excellent choice (sublimetext.com/3) ➤ Install Node.js (nodejs.org) ➤ Are you on Windows? You may want to install some additional tools: ➤ Cygwin (https://cygwin.com) ➤ GOW (https://github.com/bmatzelle/gow) ➤ GitHub for Windows (https://desktop.github.com)
  5. THE CLIENT-SERVER LOOP ➤ You request a page by typing

    a URL into your browser or clicking a link ➤ A server handles that request ➤ The server will read the contents of a file or run a program that generates HTML ➤ The HTML is sent back to your browser ➤ Your browser renders the HTML ➤ Images, CSS, and JavaScript are linked to from the HTML and run separately ➤ Each external asset loads when it is called, in the order it is referenced in HTML
  6. Clockwise from left: You request a page from any device;

    A server accepts the request and generates HTML; The HTML is sent to your browser and a web page is rendered.
  7. WEB BROWSERS ➤ There are slight differences in the way

    web browsers render pages ➤ This isn’t as much of an issue today as it was a few years ago but… ➤ You should always test in the big 3 (Chrome, Firefox, and Internet Explorer/Edge)
  8. EVERYONE LIKES TO TALK SHIT ABOUT IE ➤ And it

    was totally justified! ➤ But since version 9 there’s been less and less to complain about ➤ It’s market share is smaller (almost non-existent in some niches) ➤ Enjoy the shit talking while it lasts
  9. FRONT-END VS. BACK-END DEVELOPMENT Front-end development concerns what the user

    sees Back-end development is responsible for functionality and persistence - invisible to the user
  10. HTML BASICS ➤ What is HTML? Hypertext Markup Language ➤

    Describes the structure of content ➤ HTML pages are documents ➤ Should always be thought of as “pages” or “documents” ➤ Influences accessibility ➤ Affects Google’s view of your site (SEO) ➤ Originally built as a text-only medium
  11. HTML BASICS ➤ DOCTYPE - Tells the browser how to

    interpret the document (sort of optional but never leave it off) ➤ <html></html> - The container for the entire document ➤ <body></body> - The container for content that is to be displayed in the browser
  12. TEXT ELEMENTS ➤ <h1> - <h6> - There are 6

    levels of headings. Lower numbers are assigned to top level headings (like section titles) ➤ <p> - A paragraph tag ➤ <ul> & <ol> - Unordered (dotted) and ordered (numbered) list elements ➤ <li> - List items. Used in both ordered and unordered lists ➤ <a> - Anchor tags (for links) ➤ There are many more but these are just the most common ones
  13. SECTIONING ELEMENTS ➤ <div> - A generic division of the

    page. ➤ <main> - Denotes the main content apart from headers or footers ➤ <section> - A logical grouping of content and elements that would make sense on their own ➤ <article> - Content that can be syndicated on its own. An article, basically. But it can be more than just that. ➤ <nav> - Element that contains navigation elements ➤ <header> - The header of a page or section ➤ <footer> - Footer of a page or section or both ➤ <aside> - Additional information not part of the main content or section or a sidebar
  14. THE HEAD OF THE DOCUMENT ➤ The <head> element contains

    information about the document itself but not any content ➤ Titles, references to external assets ➤ Additional meta information and browser instructions
  15. CSS BASICS ➤ What is CSS? Cascading Stylesheets ➤ It’s

    all about the Cascade ➤ Elements, classes, and IDs are used to select parts of a document to style ➤ Selectors can be chained for greater accuracy ➤ CSS Syntax selector { property: value; }
  16. APPLYING CSS TO A PAGE ➤ Inline styling ➤ Using

    a style tag in the page head ➤ Link to an external stylesheet
  17. COMMON CSS PROPERTIES Selector Definition font-family Sets the font on

    a text element color Sets the color of text background Controls background color or image of an element font-size Set the font size of a text element font-weight Change the “boldness” of text margin Set the amount of space outside an element padding Set the amount of space inside an element border Set a border. Self-explanatory display Make an element inline, block, or hidden float Used for layout. “Floats” an element left or right
  18. CSS HOOKS ➤ A hook is some part of your

    HTML that can be used as part of a selector ➤ ID attributes on HTML elements ➤ Can only be used once per page ➤ DO NOT USE IDs FOR STYLING ➤ Class attributes on HTML elements ➤ Multiple elements can have the same class
  19. SPECIFICITY & COMBINATORS Specificity always trumps the cascade. (Figure 1)

    You can apply rules to multiple elements at once or select and chain multiple elements together to be more specific. (Figure 2)
  20. BOX MODEL ➤ Every element in your document is a

    rectangle ➤ An element’s dimensions are controlled by content, padding, margin, and borders
  21. POSITIONING ➤ Static - The default for all elements. They’ll

    render in the document flow in the order they’re written ➤ Relative - Like static but with the option to move the element from the top, right, bottom, or left from the position it started ➤ Fixed - The element will be positioned as if it’s glued to its parent — which is the top-most parent, or the top-most parent that's positioned relatively — and won’t move when scrolling ➤ Absolute - The element will be positioned relative to the browser window, not its parent, but won’t stick on screen when scrolling like fixed elements ➤ Floating - Floating originally started with the intention of having an image off to the side with text flowing around it - think of a magazine layout. It takes an element out of the normal flow and moves it either left or right.
  22. DEPLOYING A SITE ➤ We’ll set up a cheap server

    and put our files online ➤ Go here to get a free month of web hosting with DigitalOcean (https://goo.gl/oUS5M9) ➤ Sign up for an account and we’ll be online within 5 minutes
  23. LEARNING RESOURCES ➤ Beginner front-end courses http://eepurl.com/YIHFz ➤ http://eloquentjavascript.net ➤

    http://www.amazon.com/dp/0596517742/?tag=stackoverfl08-20 ➤ https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re- introduction_to_JavaScript
  24. ➤ General Assembly's Front-End Web Development Part-Time Course starts on

    February 18th. This 10 week course runs from 6pm-9pm on Tuesdays and Thursdays. In this course, students learn how to build beautiful, interactive websites using HTML, CSS, and JavaScript.. If interested, take five minutes to submit your application here today. ➤ General Assembly’s Javascript Development Part-Time Course starts on March 9th. This 10- week course runs from 6pm-9pm on Mondays and Wednesdays. In this course, students will learn how to create advanced interactive web experiences with Javascript. If interested, take five minutes to submit your application here today.
  25. JAVASCRIPT ➤ The only programming language supported by web browsers

    ➤ Used for adding interactivity to web pages ➤ Tried to piggyback off of the popularity of Java by using a similar name (JavaScript has nothing to do with Java)
  26. THE COMPONENTS OF A WEB APP ➤ Router - Routes

    URLs to code functions ➤ Models - Communicates with a database, describes data ➤ Views - The HTML pages rendered in a user’s browser ➤ Controllers - Handles a request and passes data to a view ➤ Databases - Persistent storage
  27. WEB FRAMEWORKS ➤ Don’t repeat yourself ➤ Focus on your

    problem domain, not common components