Web Design and Databases WD: Class 7: HTML and CSS Part 3

Similar documents
Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Web Design with CSS and CSS3. Dr. Jan Stelovsky

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

ITNP43: HTML Lecture 4

Selectors in Action LESSON 3

Web Design and Development ACS Chapter 9. Page Structure

ICE: HTML, CSS, and Validation

Outline of CSS: Cascading Style Sheets

Web layout guidelines for daughter sites of Scotland s Environment

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

JJY s Joomla 1.5 Template Design Tutorial:

CSS - Cascading Style Sheets

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

CST 150 Web Design I CSS Review - In-Class Lab

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

Further web design: Cascading Style Sheets Practical workbook

Style & Layout in the web: CSS and Bootstrap

CHAPTER 10. When you complete this chapter, you will be able to:

CSS. CSS - cascading style sheets CSS - permite separar num documento HTML o conteúdo do estilo. ADI css 1/28

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

Responsive Design

{color:blue; font-size: 12px;}

Web Development 1 A4 Project Description Web Architecture

Contents. Downloading the Data Files Centering Page Elements... 6

Simply download Beepip from and run the file when it arrives at your computer.

Create Webpages using HTML and CSS

Web Authoring CSS. Module Descriptor

WEB DESIGN LAB PART- A HTML LABORATORY MANUAL FOR 3 RD SEM IS AND CS ( )

Introduction to Adobe Dreamweaver CC

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

Chapter 2 HTML Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

CIS 467/602-01: Data Visualization

CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

Create Your own Company s Design Theme

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

How to code, test, and validate a web page

Creating a Resume Webpage with

CREATING HORIZONTAL NAVIGATION BAR USING ADOBE DREAMWEAVER CS5

Responsive Web Design: Media Types/Media Queries/Fluid Images

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

BASICS OF WEB DESIGN CHAPTER 2 HTML BASICS KEY CONCEPTS COPYRIGHT 2013 TERRY ANN MORRIS, ED.D

Web Design I. Spring 2009 Kevin Cole Gallaudet University

CSS for Page Layout. Key Concepts

Advanced Editor User s Guide

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

Creating Web Pages with Dreamweaver CS 6 and CSS

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

Responsive Web Design with HTML5 and CSS3

Website Development. 2 Text. 2.1 Fonts. Terry Marris September We see how to format text and separate structure from content.

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

Cascading Style Sheet (CSS) Tutorial Using Notepad. Step by step instructions with full color screen shots

MCH Strategic Data Best Practices Review

How to Create an HTML Page

BlueHornet Whitepaper

Introduction to Web Design Curriculum Sample

Web Design for Print Designers WEB DESIGN FOR PRINT DESIGNERS: WEEK 6

Advanced Web Design. Zac Van Note.

Mobile Web Site Style Guide

RESPONSIVE DESIGN BY COMMUNIGATOR

COMP519 Web Programming Autumn Cascading Style Sheets

Coding Standards for Web Development

HTML TIPS FOR DESIGNING

<Insert Picture Here>

Chapter 7 Page Layout Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Website Planning Checklist

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

GadgetStore. Magento Theme Instructions. 8theme 1 GadgetStore Magento Theme Instructions

Magento Responsive Theme Design

GUIDE TO CODE KILLER RESPONSIVE S

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

Creator Coding Guidelines Toolbox

Table of Contents THE DESIGNER S GUIDE TO CREATING NEWZAPP DRAG AND DROP TEMPLATES... 6 THE NEWZAPP SYSTEM... 7

Website Login Integration

Designing HTML s for Use in the Advanced Editor

Using Style Sheets for Consistency

So we're set? Have your text-editor ready. Be sure you use NotePad, NOT Word or even WordPad. Great, let's get going.

Campaign Guidelines and Best Practices

CSS 101. CSS CODE The code in a style sheet is made up of rules of the following types

Embedding a Data View dynamic report into an existing web-page

Cascading Style Sheets (CSS)

HTML, CSS, XML, and XSL

Chapter 8 More on Links, Layout, and Mobile Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Introduction to XHTML. 2010, Robert K. Moniot 1

<script type="text/javascript"> var _gaq = _gaq []; _gaq.push(['_setaccount', 'UA ']); _gaq.push(['_trackpageview']);

Creating HTML authored webpages using a text editor

Cascading Style Sheets (CSS)

Transcription:

Web Design and Databases WD: Class 7: HTML and CSS Part 3 Dr Helen Hastie Dept of Computer Science Heriot-Watt University Some contributions from Head First HTML with CSS and XHTML, O Reilly

Recap! HTML elements gives structure! CSS adds style

CSS Rules Selector Property Value p {! color:green,font-family: times;!! Property Value

Can apply to more than one selector Selectors Property Value p, h1 {! color:green,font-family: times;!! Property Value

Inheritance! Elements inside <p> inherit the properties of the <p>. For example: <p> <img src="images/lime_lolly.png" alt="lime Lolly" /> Bursting with <em>zing</em>. Our lime lolly is one of our best sellers </p> html body h1 h2 p p p p em img a img img img

Adding a Class <p class="lime"> <img src="images/lime_lolly.png" alt="lime Lolly" /> Bursting with <em>zing</em>. Our lime lolly is one of our best sellers. </p>

HTML body p.big and li.big *.big ".big p.big p ul em li.big li CSS li em

Elements can be in more than one class HTML <p class="lime specials"> CSS

Elements can be in more than one class What if all have the same property (e.g. color)? The last rule wins <p class="lime strawberry orange swirl > CSS

Today : Adding structure

Dividing Web pages into sections h1 Welcome to mygamezzzz.cm Xbox h2 Games Lorem ipsum dolor sit amet, facer moderatius ullamcorper p no nam, ex bonorum elaboraret ius, ut ludus populo nec. PS4 h2 Games Lorem p ipsum dolor sit amet, facer moderatius ullamcorper no nam, ex bonorum elaboraret ius, ut ludus populo nec. Lorem ipsum dolor sit amet, facer moderatius ullamcorper p no nam. Wii h2 Games Lorem p ipsum dolor sit amet, facer moderatius ullamcorper no nam.

Dividing Web pages into sections h1 Xbox h2 p h2 PS4 p p Wii h2 p

Using div to mark sections h1 Xbox div h2 p div h2 PS4 p p Wii div h2 p

Adding labels to the sections h1 Xbox div id= xbox h2 p div id= ps4 h2 PS4 p p Wii div id = wii h2 p

Lets add some style Xbox PS4 Wii h1 div id= xbox h2 p p div id= ps4 h2 p div id = wii h2 p #xbox { background-color: green; #ps4 { background-color: black; #wii { background-color: orange;

Adding borders Xbox PS4 Wii h1 div id= xbox h2 p p div id= ps4 h2 p div id = wii h2 p #xbox { border-width:thin; border-style: solid; border-color: black; background-color: green; #ps4 { background-color: black; #wii { background-color: orange;

Changing the width h1 div id= xbox h2 p #xbox { border-width:thin; border-style: solid; border-color: black; background-color: green; width: 200px; #ps4 { div id= ps4 h2 p p background-color: black; #wii { background-color: orange;

Adding structure on structure div id = header h1 div id = consoles div id= xbox h2 div id= ps4 div id = footer 960px

Adding padding

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border-width:thin; border-style: solid; border-color: black; background-color: green; #xbox-padding { border-width:thin; border-style: solid; border-color: black; background-color: green; padding-top: 25px; padding-right: 50px; padding-bottom: 25px; padding-left: 50px; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div> <br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> </div> </body> 50px 25px 25px Adding padding 50px

Short cut padding-top: 25px; padding-right: 50px; padding-bottom: 25px; padding-left: 50px; top right bottom left padding: 25px 50px 25px 50px;

Short cut borders border-width:thin; border-style: solid; border-color: black; They can be in any order you like border: thin solid black;

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border: thin solid black; background-color: green; #xbox-padding { border: thin solid black; background-color: green; 50px padding: 25px 50px 25px 50px; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div> <br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> </div> </body> </html> 25px 25px Adding padding 50px

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border: thin solid black; background-color: green; #xbox-padding { border: thin solid black; background-color: green; padding: 25px 50px 25px 50px; margin-left:100px; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div> <br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> </div> 100px Adding margins

Margin short cuts margin-top: 25px; margin-right: 50px; margin-bottom: 25px; margin-left: 50px; top right bottom left margin: 25px 50px 25px 50px;

If all the same margin-top: 20px; margin-right: 20px; margin-bottom: 20px; margin-left: 20px; margin: 20px; Works for padding too

If top and bottom are the same margin-top: 0px; margin-right: 20px; margin-bottom: 0px; margin-left: 20px; Top and bottom Right and left margin: 0px 20px; Works for padding too

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border: thin solid black; background-color: green; #xbox-padding { border: thin solid black; background-color: green; padding: 25px 50px 25px 50px; margin-left:100px; text-align: right; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div><br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> Making the text align within a div

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border: thin solid black; background-color: green; #xbox-padding { border: thin solid black; background-color: green; padding: 25px 50px 25px 50px; width: 200px; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div> <br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> </div> </body> </html> Changing the width of a div

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border: thin solid black; background-color: green; #xbox-padding { border: thin solid black; background-color: green; padding: 25px 50px 25px 50px; width: 200px; float: right; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div> <br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> </div> </body> Changing the position with float

<!DOCTYPE html> <html> <head> <style> #xbox-nopadding { border: thin solid black; background-color: green; #xbox-padding { border: thin solid black; background-color: green; padding: 25px 50px 25px 50px; width: 200px; position: absolute; top: 100px; right: 200px; </style> </head> <body> <div id="xbox-nopadding"> With no padding: Lorem Ipsum is simply. </div> <br> <div id="xbox-padding"> With padding: Lorem Ipsum is.. </div> Changing the position with absolute position

Coping with overlap div id = main div id = sidebar Overlap with floating sidebar div id = footer

Coping with overlap Better! div= main div= sidebar #footer{ padding: 15px; margin: 10px; clear: right; Div= footer

Don t over do it! Don t add <div>s unnecessarily.! Adding structure for sections adds clarity and style! Adding <div>s for the sake of it creates unnecessarily complicated structure

Short cut!! Free div generators! E.g. http://divoverlaylayouts.com/

Div and inheritance h1, h2 { color: red; body h1 h2 div id= xbox h2 h3 h3

We want the div h2 to be different Parent element descendent div h2 { color: green; body h1 h2 div id= xbox Rule: select any h2 descendent of any div h2 h3 h3

But we just want this for xbox div Parent element descendent #xbox h2 { color: green; body h1 h2 div id= xbox Rule: select any h2 descendent of xbox div h2 h3 h3

Now you try: write the selector that only selects <h3> elements inside the ps4 and makes it orange body h1 h2 div id= xbox div id= ps4 h2 h2 h3 h1 h3 h3

Now you try: write the selector that only selects <h3> elements inside the ps4 and makes it orange #ps4 h3 { color: orange; body h1 h2 div id= xbox div id= ps4 h2 h3 h3 h1 h2 h3

Background colour <!DOCTYPE html> <html> <head> <style> body { background-color: #a4f3f3; </style> </head> <body> <h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

Adding a picture <!DOCTYPE html> <html> <head> <style> body { background-color: #a4f3f3; background-image: url("img_tree.png"); </style> </head> <body> <h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

Background no-repeat <!DOCTYPE html> <html> <head> <style> body { background-color: #a4f3f3; background-image: url("img_tree.png"); background-repeat: no-repeat; </style> </head> <body> <h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

Background repeat-y <!DOCTYPE html> <html> <head> <style> body { background-color: #a4f3f3; background-image: url("img_tree.png"); background-repeat: repeat-y; </style> </head> <body> <h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

Background repeat-x <!DOCTYPE html> <html> <head> <style> body { background-color: #a4f3f3; background-image: url("img_tree.png"); background-repeat: repeat-x; </style> </head> <body> <h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

Background position <!DOCTYPE html> <html> <head> <style> body { background-color: #a4f3f3; background-image: url("img_tree.png"); background-repeat: no-repeat; background-position: right top; </style> </head> <body> <h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

Shortcut: background <!DOCTYPE html> They can be in any <html> order you like <head> <style> body { background: #a4f3f3 url("img_tree.gif") no-repeat right top; </style> </head> <body><h1>hello World!</h1> <p> Learning about backgrounds</p> </body> </html>

font-family San-serif considered easier to read on screen Generic family Serif San-serif Monospace Font Family Times New Roman Georgia Arial Verdana Courier New Lucinda console

Font-family cont Have Have several several fontfamilies as fall font-families as fall back back in case in case browser browser doesn t doesn t support support the the first first p { font-family: "Times New Roman", Times, serif;

Font short cuts font-style: italic; font-weight: bold; font-size: 12px; line-height: 30px; font-family: Georgia, serif; You ll also see this in em Style: optional Variant: weight Size/line height: NOT Optional Font-family- use commas between font family names font: italic bold 12px/30px Georgia, serif;

Font short cuts <!DOCTYPE html> <html> <head> <style> p.ex1 { font: 15px arial, sans-serif; Ordering matters! p.ex2 { font: italic bold 12px/30px Georgia, serif; </style> </head> <body> <p class="ex1">this is a paragraph..</p> <p class="ex2">this is a paragraph. This is a paragraph. This is a paragraph.</p> </body> </html>

Span! The <span> tag provides a way to add a hook to a part of a text or a part of a document.! <span> doesn t change the text in anyway! Let s you add style certain parts of the text for example

Example <!DOCTYPE html> <html> <head> <style> body{ background-color: #a4f3f3; </style> </head> <body> <p> Xboxes have green boxes. Wiis have white boxes.</p> </body> </html>

Adding spans- nothing happens <!DOCTYPE html> <html> <head> <style> body{ background-color: #a4f3f3; </style> </head> <body> <p> Xboxes have <span> green </span> boxes. Wiis have <span> white </span> boxes.</p></body> </html>

Adding spans with class- still nothing happens <!DOCTYPE html> <html> <head> <style> body{ background-color: #a4f3f3; </style> </head> <body> <p> Xboxes have <span class="xbox"> green </span> boxes. Wiis have <span class-"wii"> white </span> boxes.</p></body> </html>

Adding style to a span class <!DOCTYPE html> <html> <head> <style> body{ background-color: #a4f3f3;.xbox { color: green;.wii { color: white </style> </head> <body> <p> Xboxes have <span class="xbox"> green </span> boxes. Wiis have <span class="wii"> white </span> boxes.</p> </body> </html>

Or add style directly to class <!DOCTYPE html> <html> <head> <style> body{ background-color: #a4f3f3; </style> </head> <body> <p> Xboxes have <span style="color:green"> green </span> boxes. Wiis have <span style="color:white"> white </span> boxes.</p> </body> </html>

That s all fine and good! but..html5 has some other tricks up it s sleeve to make things even clearer

<div id= header > <div id= drinks > <div id= main > <div id= sidebar > <div id= footer >

<section> <header> <section id= drinks > <section id= main > <aside> <footer>

Pardon me?! I thought we d been learning about <div>! What s the difference between <div> and <section>?

<section> vs <div>! <section> marks a block on content that belongs to the same semantic category.! Rule of thumb- would the content be listed in a table of contents?! Yes- then it s <section>

What about poor old <div>?! We can still use this but the <div> classes don t capture any particular meaning- they can be arbitrary! div = used to capture structure and feature inheritance! div = a generic container element! div= used for styling purposes or as a convenience for scripting

<header> <div id= header > <header> now <header> Used for logo and <section id= drinks > <section id= main > <aside> utilities <footer>

<footer> <div id= footer > <header> Now <footer> Used for boring legal <section id= drinks > <section id= main > <aside> stuff <footer>

<aside> <div id= sidebar > <header> now <aside> content- aside from the <section id= drinks > <section id= main > <aside> content it is placed in. Used for sidebars. <footer>

<nav> Navigation = list of links Put just under <header> <nav> <ul> <li> <a href ="index.html"> Home </a> <li> <a href ="directions.html"> Directions </a> <li> <a href ="contact.html"> Contact us </a> </ul> </nav>

Vertical <nav> But with the bullets and margins and paddings removed ul { list-style-type: none; margin: 0; padding: 0;

Horizontal <nav> li { display: inline;

Now let s spread them out li { top right bottom left display: inline; padding: 10px 10px 5px 10px; 10px 20px 5px

For more about <nav>! http://www.w3schools.com/css/ css_navbar.asp

Summary! Divs allow structure! Span allow styling of in-line parts of the website! Font! HTML5 has element names w/r structure to capture the semantic content of the websites (<header>, <footer>, <section>, <nav>)

For Part II! Implement at least one webpage, e.g. the homepage- roughly similar to your Part 1 design! The rest can be unstyled for the forms/mysql/php part! Include the following:! colours! Graphics! structure website! You can use the css style sheet from the labs, a div generator or create your own from scratch! Double lab in Week 5 to work on this

Resources! Use the websites you ve worked on in the lab! Use templates from here: http://zypopwebtemplates.com/tag/left-sidebar Other helpful resources http://www.w3schools.com/html/ html_layout.asp http://www.pagecolumn.com/3_ col_generator.htm

Next time Mock-up Oscars 2015