VISA/APCO/STAC 2P61 WEBSITE CREATION Fall Term 2012

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

Block & Inline Elements

CSS: Cascading Style Sheets

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

Lab Introduction to Cascading Style Sheets

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

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

The Importance of the CSS Box Model

Introduction to WEB PROGRAMMING

Styles, Style Sheets, the Box Model and Liquid Layout

Web Design and Implementation

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

Using CSS for page layout

Chapter 3 Style Sheets: CSS

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

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

Creating Layouts Using CSS. Lesson 9

CSS worksheet. JMC 105 Drake University

Module 2 (VII): CSS [Part 4]

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

CSS: The Basics CISC 282 September 20, 2014

CSS.

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

Cascading Style Sheets Level 2

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

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

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

CSS. Shan-Hung Wu CS, NTHU

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

Getting Started with Eric Meyer's CSS Sculptor 1.0

ADOBE 9A Adobe Dreamweaver CS4 ACE.

ITSE 1401 Web Design Tools Lab Project 4 (Expression Web 4 - Units M, N, O, P) Last revised: 1/9/14

Create a three column layout using CSS, divs and floating

CSS Cascading Style Sheets

CSS THE M\SS1NG MANUAL. David Sawyer McFarland. POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo

Zen Garden. CSS Zen Garden

Layout with Layers and CSS

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

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

Cascading Style Sheets for layout II CS7026

2. Write style rules for how you d like certain elements to look.

ICT IGCSE Practical Revision Presentation Web Authoring

Back in the good old days type was set by hand using printing presses.

Html basics Course Outline

Santa Tracker. Release Notes Version 1.0

Assignments (4) Assessment as per Schedule (2)

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Internet Programming 1 ITG 212 / A

Fundamentals of Web Technologies. Agenda: CSS Layout (Box Model) CSS Layout: Box Model. All HTML elements can be considered as a box or a container

Web Development & Design Foundations with HTML5

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

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

COMS 359: Interactive Media

Groupings and Selectors

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

HTML and CSS a further introduction

Web Development & Design Foundations with HTML5

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

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

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

Website Development with HTML5, CSS and Bootstrap

Getting Started with CSS Sculptor 3

PUBLISHER SPECIFIC CSS RULES

TAG STYLE SELECTORS. div Think of this as a box that contains things, such as text or images. It can also just be a

What is the Box Model?

Appendix D CSS Properties and Values

.hedgehog { background-image: url(backyard.jpg); color: #ffff99; height: 6in; width: 12in; } .tube {

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

Cascading Style Sheets CSCI 311

Taking Fireworks Template and Applying it to Dreamweaver

Symbols INDEX. !important rule, rule, , 146, , rule,

CS193X: Web Programming Fundamentals

How to lay out a web page with CSS

Tutorial 4: Creating Special Effects with CSS

ITNP43: HTML Lecture 4


3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal />

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

Setting a Background Image

ENGINEERING DATA HUB VISUAL DESIGN SPECIFICATIONS VERSION 3. Created: 2/10/2017

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

Web Designer s Reference

CS 1100: Web Development: Client Side Coding / Fall 2016 Lab 2: More HTML and CSS

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

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

Class 9 / Instructor: Ira Epstein

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

CSS: formatting webpages

Lab 2: Movie Review. overview.png background.png rottenbig.png rbg.png fresh.gif rotten.gif critic.gif

Using Dreamweaver CS6

ASMP Website Design Specifications

Web Design and Development ACS Chapter 12. Using Tables 11/23/2017 1

Getting your work online. behance.net cargo collective krop coroflot

Programmazione Web a.a. 2017/2018 HTML5

2005 WebGUI Users Conference

Web Site Design and Development Lecture 9. CS 0134 Fall 2018 Tues and Thurs 1:00 2:15PM

INFS 2150 Introduction to Web Development

Transcription:

VISA/APCO/STAC 2P61 WEBSITE CREATION Fall Term 2012 CSS 4 TWO COLUMN LAYOUT MORE ON DIVS Last week: Applied margins borders and padding and calculating the size of elements using box model. Wrote CSS shorthand for these so the CSS is efficient. Created <div> (block level) and <span> (inline) elements and targeting them with CSS Used id= and class= to <div> to enable CSS to be more targeted Here are two ways to more specifically target your CSS Using descendent selectors e.g. how to write a rule for a specific <p> element e.g. in footer Sometimes called contextual selectors. #footer p font-size: 11px; color: #383330 Tells browser to look at any instance of the element p in the div footer and apply this rule Styling details in the span element Span element is inline <p> The <span class= primate >Famous Primates</span>website is a Web Standardistas production</p.=> Wrapping the word Famous Primates in a span and giving it a class of primate we can write a CSS rule and target it at all instance of the class primate..primate text-transform: uppercase; font-weight: bold; Styling with Class attributes Use a class attribute to add style to the image of King Kongʼs portrait. <img src= images/king-kong.jpg <width- 500 height= 350 alt= The mighty King Kong, a fearsome giant ape. Title= King Kong contemplates scaling yet another tall building. class= portrait </> The write a CSS rule to target only an image with the class of portrait.portrait 1

margin: 10px 0; border: 1px solid ##FFF7DD; padding: 4px; TWO COLUMN LAYOUTS WITH CSS Look at the examples in the Web Standardistas book Chapter 11 http://webstandardistas.com/11 TWO CONCEPTS FOR CREATING MULTICOLUMN LAYOUTS 1. document flow Elements on page flow down starting with the first element at the top left and subsequent elements below. e.g. all elements try to sit as close to the top left of the page as possible. 2. Floats We use the float property to remove elements from this document flow. Hereʼs a simple page with no floats: <h1>no Floats</h1> <div id= container > <div> class= box <h2>div 1</h2> </div> <div> class= box <h2>div 2</h2> </div> <div> class= box <h2>div 3</h2> </div> </div> styled in CSS body margin: 20px; padding: 0; font-family: ʻLucida Grandeʼ, Lucida Sansʼ, Arial, sans-serif; background-color: #CCCCCC #container width: 400px; height: 400px; border: 1px solid: #000000 background-color: #FFFFFF 2

.box width: 100px; height: 100px; This page http://www.webstandardistas.com/11/ displays in browser with 3 divs one below the other. Div is block level forces line break Follows normal document flow Apply a float: left to the class of box.box float: left; width: 100px; height: 100px; This page http://www.webstandardistas.com/11/floating_divs_02.html displays in browser All divs removed from normal document flow Moves them left so the three display horizontally Try float: right; This displays this way http://www.webstandardistas.com/11/floating_divs_03.html The order of the divs follows with div 1 going as far right as possible and the other following. What happens if all divs are not floated? <div id= content > <div class= boxspecial ><h2>div 1</h2></div> <div> class= box <h2>div 2</h2> </div> <div> class= box <h2>div 3</h2> </div> </div> note we have two different classes now box and boxspecial. We can target a CSS rule to each of these classes..box width: 100px; height: 100px; 3

.boxspecial float: right; width: 100px; height: 100px; The resulting page http://www.webstandardistas.com/11/floating_divs_04.html has only the boxspecial floated to the right. Div 2 and 3 have no float specified so they follow the normal document flow. You can set up divs of different sizes If they are larger than the container, then one has to occupy the first space below; See http://www.webstandardistas.com/11/floating_divs_05.html Where div 3 canʼt move to upper left and so it falls below div 2 because there is space available there. If we wanted div 3 to drop below div 1 we have to clear the floats of div 1 and div 2..box3 float: leftʼ width: 160px; height: 140px; clear: both; the result is http://www.webstandardistas.com/11/floating_divs_06.html the clear declaration on div 3 clears the floats. Add a sidebar to the 1 column layout we created last week The content is tagged as follows: <body> <div id= content > <div id= header > Header </div> <div id= content > Content </div> <div id= sidebar > Sidebar </div> <div id= footer > Footer </div> </div> </body> 4

Remember weʼre using a container and the aim is 2 columns Regardless of the order our content appears in the markup we can float the content or sidebar divs in either direction We control the display in the CSS with floats Changing the float values Creating a 2 column layout A 2 column layout with no floats http://www.webstandardistas.com/11/two_column_layout_01.html Uses the normal document flow A 2 column layout with content div floated left and sidebar floated right http://www.webstandardistas.com/11/two_column_layout_02.html A 2 column layout with content div floated right and sidebar floated left http://www.webstandardistas.com/11/two_column_layout_03.html Important: specify width on floated elements. An element without specific width should shrink to be as wide as the content within it. So always specify width Create markup in as logical a manner as possible and then control it with CSS Havenʼt specified height of sidebar div and it is only as tall as it needs to be to accommodate its content So background colour of container shows through 5

To make sure our footer (which has not width on it) displays below both the content and sidebar divs apply a clear: both property. Itʼs important to calculate width of elements to make sure they fit side by side in container Remember box model calculated by adding width of element and adding margins, padding and border. In http://www.webstandardistas.com/11/two_column_layout_03.html we see the divʼs full calculated widths for the content and sidbar divs are = to the width of the container. Padding-left + element width + padding-right Content div -- 20px + 510px +20px = 550 and sidebar div 20px + 200px + 20px = 240. Total 790px What if elements are too wide? In http://www.webstandardistas.com/11/container_too_small.html combined width of content and sidebar divʼs is too wide for the container. As a result, the sidebar floats to the right as it should but below the content. Collapsing margins When you have equal margins around all four sides of a paragraph or other element collapsing margins take hold. This means that: where two elements touch vertically the smaller of these margins collapses to zero. This creates even spacing between paragraphs and elements. It makes writing the CSS easier. It can be overridden (with an additional class) Applying a Float to an image In normal document flow if we have an image the paragraphs will simply line up below. But what if you want the image to rest beside the paragraphs? We can do this with a class See example http://www.webstandardistas.com/11/image_floated_left.html 6

The CSS rule will targets the class.tallprimate which is floated left with padding The XHTML adds the class= tallprimate to the img tag. What if the floated image were taller than the container? It will break out of the layout because it is taken out of the normal doc flow when floated. Solutions: Re-size image Add -- clear: both; on #footer Add overflow: auto; on #content Overflow property determines how content inside a div or other block level element should be displayed if its width or height exceeds that specified for the container element. Faux Columns Since our columns in the CSS 2 column only expand to fill the content they occupy the sidebar in this http://www.webstandardistas.com/11/two_column_layout_02.html does not fill the space. This may not be a problem if your container background colour is the same as your div background colour Ideally it would extend to fill the vertical space as the longer content column does. Hereʼs a solution: faux columns: Create and define a background-image for the container div that can be tiled vertically to create the effect of 2 columns. 790 x 10 px then adjust your #container CSS by adding background-imge: url(faux_column.jpg); background-repeat: repeat-y; the result will look like this: 7

In class work: Have a look at the King Kong page with a 2 column layout is CSS http://www.webstandardistas.com/11/king_kong.html Work on the gordo.html page. Go to: http://www.webstandardistas.com/11/assets.zip and you will get images to add to the gordo.html page. Use the container_bg.png from the assets to make the background-image for the container. Also add body_bg.png and famous_primates_brand.png Add a sidebar div Add a sidebar rule to CSS Measure the divs in the last version your only had one column. Now there will be a content div and a sidebar div. Youʼll need to widen the container div. Set appropriate widths for the content and sidebar divs. Add floats Add padding to your sidebar Add the faux columns to give the illusion that your content and sidebar divs are occupying the same vertical length 8