Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Similar documents
Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

CSS: The Basics CISC 282 September 20, 2014

Introduction to WEB PROGRAMMING

Styles, Style Sheets, the Box Model and Liquid Layout

CSS.

CSS Cascading Style Sheets

Introduction to HTML & CSS. Instructor: Beck Johnson Week 2

HTML and CSS COURSE SYLLABUS

HTML + CSS. ScottyLabs WDW. Overview HTML Tags CSS Properties Resources

ICT IGCSE Practical Revision Presentation Web Authoring

ICT IGCSE Practical Revision Presentation Web Authoring

Website Development with HTML5, CSS and Bootstrap

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

CSS Selectors. element selectors. .class selectors. #id selectors

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

COMS 359: Interactive Media

Zen Garden. CSS Zen Garden

Assignments (4) Assessment as per Schedule (2)

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

Introduction to using HTML to design webpages

CSC 121 Computers and Scientific Thinking

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

Table Basics. The structure of an table

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

Data Visualization (CIS/DSC 468)

CSS Cascading Style Sheets

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

Cascading Style Sheets Level 2

Responsive Web Design (RWD)

What is the Box Model?

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

Deccansoft Software Services

Block & Inline Elements

CSS worksheet. JMC 105 Drake University

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Web Design and Development Tutorial 03

BIM222 Internet Programming

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

Cascading Style Sheets (CSS)

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

When you complete this chapter, you will be able to:

Adding CSS to your HTML

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

CSS. Lecture 16 COMPSCI 111/111G SS 2018

The Importance of the CSS Box Model

Chapter 3 Style Sheets: CSS

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

Programmazione Web a.a. 2017/2018 HTML5

A Balanced Introduction to Computer Science, 3/E

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

Data Visualization (DSC 530/CIS )

ITNP43: HTML Lecture 4

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

Getting Started with Eric Meyer's CSS Sculptor 1.0

CSS Design and Layout Basic Exercise instructions. Today's exercises. Part 1: Arrange Page into Sections. Part 1, details (screenshot below)

Appendix D CSS Properties and Values

CSS Lecture 16 COMPSCI 111/111G SS 2018

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

Web Engineering CSS. By Assistant Prof Malik M Ali

HTML and CSS a further introduction

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Introduction to Web Design CSS Reference

Basics of Web Design, 3 rd Edition Instructor Materials Chapter 2 Test Bank

Introduction to Web Design CSS Reference

Using Dreamweaver CC. Logo. 4 Creating a Template. Page Heading. Page content in this area. About Us Gallery Ordering Contact Us Links

Reading 2.2 Cascading Style Sheets

Creating Web Pages with SeaMonkey Composer

FEWD START SCREENCAST!!!!

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

The internet is a worldwide collection of networks that link millions of computers. These links allow the computers to share and send data.

ID1354 Internet Applications

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

HTML/XML. HTML Continued Introduction to CSS

CSS is applied to an existing HTML web document--both working in tandem to display web pages.

First Name Last Name CS-081 March 23, 2010 Midterm Exam

Web Development & Design Foundations with HTML5 & CSS3 Instructor Materials Chapter 2 Test Bank

Learning Objectives. Review html Learn to write a basic webpage in html Understand what the basic building blocks of html are

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

1/6/ :28 AM Approved New Course (First Version) CS 50A Course Outline as of Fall 2014

Creating and Building Websites

What do we mean by layouts?

Lecture : 3. Practical : 2. Course Credit. Tutorial : 0. Total : 5. Course Learning Outcomes

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) More on Relative Linking. Learning Objectives (2 of 2)

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

It is possible to create webpages without knowing anything about the HTML source behind the page.

Layout with Layers and CSS

CREATING A WEBSITE USING CSS. Mrs. Procopio CTEC6 MYP1

Methods for configuring Cascading Style Sheets. Applying style to element name selectors. Style Rule Basics. CMPT 165: Cascading Style Sheets

Page Layout Using Tables

Transcription:

Make a Website A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Overview Course outcome: You'll build four simple websites using web development fundamentals, including HTML5/CSS3 and Bootstrap. You'll learn to understand and modify the structure of basic website, as well as how to change the way a page looks and is laid out. Why learn HTML and CSS? Everything you see in a website is a result of the combination of HTML and CSS. With these two languages, you will have the skills you need to bring your website design to life. Jumpstart that vision by using Bootstrap, a popular library that allows you to create beautiful, responsive pages with very little time and experience. Course syllabus: {Site Structure: Page 3} {A Closer Look at CSS: Page 8} {Boundaries and Space: Page 13} {Building with Bootstrap: Page 18} Created by Michael Parekh 2

Make a Website: Site Structure What are HTML and CSS? All websites use HTML and CSS! HTML stands for Hyper Text Markup Language. It is used to give websites structure with text, links, images, and other fundamental elements. CSS stands for Cascading Style Sheets. It is used to change the appearance of HTML. Anatomy of an HTML Element The element shown is called a heading: 1) All HTML elements begin with an opening tag. In this case, the opening tag is <h1>. 2) Most elements require a closing tag, denoted by a /. In this case, the closing tag is </h1>. 3) The website user only sees the content between the opening and closing tags. Add a Heading Headings are a frequently used HTML element. They are like headlines on a newspaper and are typically large and bold. There are six heading elements: h1, h2, h3, h4, h5, and h6. h1 is the largest heading and h6 is the smallest. Add a Paragraph The HTML paragraph element, p, is used to hold one or more sentences, just like paragraphs in an essay or a book. Created by Michael Parekh 3

Anchor Elements What if you wanted to link users to a different webpage? You can easily do this by using the HTML anchor element. Anchor elements use the href attribute, which specifies the webpage to link to. Attributes customize the behavior or appearance of HTML elements. A Closer Look The diagram below illustrates the different parts of the anchor element syntax. 1) Any valid URL can be used for the value of the href attribute. 2) The URL must be enclosed with quotation marks. 3) Text between the <a> and </a> tags can be as few or as many words as you would like. Adding Images To add images to a webpage, use the HTML image element: Created by Michael Parekh 4

Image URLs typically end with the.jpg or.png file extension. The src attribute sets the source for an image element. Image elements are self-closing, which means they do not need a closing tag. Adding a Video The HTML video element can add video to a webpage: 1) width and height: Set the size of the screen that displays the video. 2) controls: Adds play, pause and volume control. 3) source src: Sets the URL of the video to play. 4) type: Specifies different video formats. Create an Unordered List Items in an unordered list are referred to as list items. Each item is bulleted, not numbered. About unordered lists: 1) ul tags create the unordered list. 2) li tags contain each list item. Created by Michael Parekh 5

Unordered list elements can be used to organize content on a webpage in a number of ways. One example is to create a website s navigation bar or navbar. Parent and Child Elements With the video and unordered list elements, you may have noticed something interesting: these HTML elements had other HTML elements nested inside of them. Code indentations indicate parent and child elements. Web developers refer to the enclosing element as the parent element and the enclosed elements as children. Add a Div Div elements divide your page by enclosing other elements. These enclosed groups of elements can then be organized, moved and styled independently from one another. Div elements are often used with the class attribute. Here's an example: The... indicates where other HTML elements would normally be enclosed by the div. Metadata: The Brains These elements are the "brains" of a webpage because they communicate vital information to the web browser, but are not visible to a webpage visitor. Created by Michael Parekh 6

1) <!DOCTYPE html>: Tells the web browser to expect an HTML document. 2) <html> </html>: The root of the HTML document and parent of all other HTML elements on the webpage. 3) <head> </head>: Enclose other metadata about the site, such as its title. 4) <title> </title>: Contains the site's title, which is one way users can find your site through a search engine, like Google. 5) <meta charset="utf-8"/>: Tells the web browser which character set to use. In this case, the character set is "utf-8". Created by Michael Parekh 7

Make a Website: A Closer Look at CSS Why use CSS? CSS is a language used to style websites. Colors, fonts, and page layouts for a site can all be managed using CSS. Link to a Stylesheet The HTML link element links a CSS file to an HTML file so that CSS styling can be applied. Here's an example of the link element: About link: 1) The link element uses three attributes: -rel: Specifies the relationship between the current file and the file being linked to: in this case, the rel attribute is "stylesheet". -type: Specifies the type of file linked to. -href: Provides the URL of the file being linked to. 2) Like the HTML image element, link is self-closing. It does not need a closing tag. 3) In the example above, main.css is an external style sheet. Using external stylesheets is one of the most popular ways to write CSS. Inline CSS is another method. Anatomy of a CSS Rule The diagram below shows the anatomy of a CSS rule: Created by Michael Parekh 8

1) rule: a list of CSS instructions for how to style a specific HTML element or group of HTML elements. 2) selector: specifies exactly which HTML elements to style. Here h1 is the selector. 3) properties and values: located inside the { } brackets, properties and values specify what aspect of the selector to style. Font-Family In CSS, font is managed using the font-family property: Above, the font-family property of the h1 selector is set to the value of Georgia, with serif as a fallback font. Fallback fonts are included in case a visitor's web browser does not support the first font. Sometimes, more than one fallback font is included. Color In CSS, the color property sets the color of a CSS selector's font: Created by Michael Parekh 9

CSS comes equipped with 140 named colors, such as red. However, sometimes web developers will use hexadecimal or RGB to achieve a more specific color. 1) hexadecimal color (#RRGGBB): Hexadecimal values that represent mixtures of red, green and blue. For example, red can be expressed with the hexadecimal value of #FF0000: the value ff represents red, 00 represents green, and 00 represents blue. 2) RGB (Red, Green, Blue) colors: Color created by three numbers representing red, green, and blue. When mixed together, the three values create a specific color. For example: purple can be represented as rgb(128,0,128). CSS Class Selectors We can use class selectors to target classes of HTML elements: CSS styles applied to the header class selector will automatically apply to the h2 and the p. In CSS, class selectors can be identified by a dot. followed by the class name, as seen below: As a result of this code, child elements of divs with the header class will have a font color of #ffffff (white). Created by Michael Parekh 10

Font-Size The font-size property sets the size of an HTML element's text. In CSS, size can be assigned in pixels (px), rems, or ems: 1) pixel (px): Standard unit of measurement for sizing fonts and other HTML elements. 2) rem: Represents the default font size for the web browser. Rems can be used to ensure that HTML elements scale in proportion to each other on various web browsers and screen sizes. On most web browsers, 1rem is equivalent to 16px 3) em: A relative value that changes in proportion to the size of the parent element. For example, if a parent element has font-size: 20px;, child elements with font-size: 1em; would be equivalent to 20px. A Background Image In CSS, the background-image property sets the background image The CSS rule above assigns a background image to elements that have a class attribute set to hero. Created by Michael Parekh 11

You can also control the size of the background image by using the background-size property. Here, we have specified that we want the image to completely cover elements with the.hero class. CSS id Selectors To style one element differently from all the others on the webpage, you could use the HTML id attribute. Then in the CSS file, you would create a rule for the id selector, using a # symbol: About using id: 1) An id attribute can only be used once because the id is unique to the element it is assigned to. 2) Ids have greater specificity than classes. If an HTML element is using both id and class attributes, the CSS rule for the id will take precedence over that of the class. Created by Michael Parekh 12

Make a Website: Boundaries and Space The Box Model Every page element has boundary and space properties that can be controlled using CSS. The CSS box model illustrates each of these properties. Create a Border The border property can be used to visually define a page element's outer edge. In CSS, the border property's value requires three parts: 1) thickness: Sets the thickness of the border, using pixels, ems, or rems. 2) type: Sets the border type. Common options are solid, dotted, and dashed. 3) color: sets the border's color, using named colors, HEX, or RGB values. Working with Padding Created by Michael Parekh 13

The CSS padding property controls the empty space between the page element's content and its border. Working with Margin The CSS margin property controls the space between different HTML elements on a webpage. Use margin to bring page elements closer together or to move them further apart. The CSS below ensures 2rems of space between elements with the class answer and surrounding page elements. More Margins It is possible to set separate margin spacings on each side of an element. Additional margin properties: 1) margin-top: Sets the top margin. 2) margin-bottom: Sets the bottom margin. 3) margin-left: Sets the left margin. 4) margin-right: Sets the right margin. Created by Michael Parekh 14

Understanding Display The CSS display and position properties allow us to more elements around the page and create unique layouts. Not all HTML elements are displayed on a page in the same way. Display types determine how HTML elements will be arranged in relation to each other. The diagram below illustrates the block and inline display types: 1) HTML heading, paragraph, and unordered list elements are block level: each appears on its own line on the webpage. 2) HTML image and anchor elements are displayed inline: they appear on the same line as their neighboring elements on the webpage. Keep it Inline Display types can be overwritten by using the display property. One important thing to note is that the HTML nav element is used to organize navigation bars. Created by Michael Parekh 15

For example, we can make list items appear on the same line by setting display to inline: Using Float By using float, we have the option of floating elements left or right. This allows us to fill empty space, such as when creating a navigation bar. Display: Flex Flex can be used to easily align and arrange elements, such as images. By using flex, we can create galleries and much more. For example, To make children of a div align horizontally on the webpage, we can use: Children elements of the div with class parent will now align horizontally. We can make sure no child element moves off the page by using flex-wrap: wrap;. In addition, to center rows of children elements, we can use justify-content: center;: Created by Michael Parekh 16

Working with Position The CSS position property enables you to position HTML elements in exact locations on a webpage. By first setting position: relative;, you can then use the CSS properties top, left, bottom, and right to shift an element away from where it would have normally appeared on the page. The code snippet below moves a div with the class container 10px away from the up and 20px away from the left side of the page. Note that :active is a pseudo-class selector, which we use to style an element only while it is being clicked. It is most commonly used with the position property on buttons. Created by Michael Parekh 17

Make a Website: Building with Bootstrap CSS Frameworks Bootstrap is a popular CSS framework with prewritten CSS rules designed to help you build webpages faster. Here are three new HTML elements: 1) header: Used to organize headers on a webpage. 2) footer: Used to organize footers on a webpage. 3) section: Defines sections on a webpage Connecting to Bootstrap The HTML link element makes Bootstrap available to us. It is kept within the head tags. On the Grid One of the reasons Bootstrap and frameworks like it are so popular is because they offer grids. A grid makes it possible to organize HTML elements using preconfigured columns. The Bootstrap grid contains 12 equal-sized columns, as shown below. HTML elements are arranged to span different numbers of columns in order to create custom page layouts. Created by Michael Parekh 18

In the diagram, observe the following: 1) Bootstrap s grid columns are represented by 12 vertical bars. The boxes represent HTML elements. 2) The words "container", "jumbotron", "col-sm-6" and "col-sm-3" refer to Bootstrap classes. 3) The element with class "jumbotron" spans the entire width of the webpage, beyond the borders of the grid. 4) Elements inside the second "container", such as "col-sm-6" and "col-sm-3" are contained within the grid columns. 5) Elements labeled "col-sm-3" take up three grid columns; elements labeled "col-sm-6" take up six grid columns. Header/Navigation In the example code below, an HTML header element with Bootstrap's predefined container class is used. Inside the header, a row is created by using a div with Bootstrap's row class. Finally, the row is cut into two parts: Created by Michael Parekh 19

The first part consists of the h1 with Bootstrap's class col-sm-4. It will take up the first four columns on the grid. The second part consists of the nav element with class col-sm-8. It will take up the remaining eight grid columns. textright indicates that text will be arranged on the right side of the nav. The Jumbotron In addition to a header/navigation, many websites have a large showcase area featuring important content. Bootstrap refers to this as a jumbotron. First, a new section element is created and assigned the jumbotron class. Next a div with the Bootstrap class container is used. A div with the Bootstrap class row text-center can center subsequent child elements which will contain text: The... is a placeholder for HTML elements Note that Bootstrap's btn btn-primary class, transforms into a button. Created by Michael Parekh 20

Supporting Content Many websites have a supporting content area. First, an HTML section element with the container class is used. Next, div elements with the row class are added. Finally, the rows are divided by using divs with Bootstrap's col-sm-... class. Above, two rows are divided into two equal parts. Each part takes up 6 of bootstrap's 12 columns. Using col-sm-6 ensures that the page can be viewed properly on any device. Footers Footers display copyright information, social media links and sometimes site navigation. Created by Michael Parekh 21

First, a footer element with Bootstrap's container class is used. Inside the footer, a div with Bootstrap's row class is added to hold footer content. Finally, the row is divided into parts using Bootstrap's grid: Above, the row is broken into three parts: a p element that takes up four columns, a ul which takes up 8 columns, and li items which take up 1 column each. The lis could hold navigation menu items or social media icons. Note: &copy is a character code, which web browsers interpret as the copyright symbol:. Created by Michael Parekh 22