CSS Layout Part I. Web Development

Similar documents
Divs, Classes & IDs. Web Development

CSS for Page Layout Robert K. Moniot 1

COMS 359: Interactive Media

Web Design and Implementation

12/9/2012. CSS Layout

Using CSS for page layout

Cascading Style Sheets for layout II CS7026

FLOATING AND POSITIONING

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

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

COMSC-031 Web Site Development- Part 2

CSS worksheet. JMC 105 Drake University

HTML Organizing Page Content

Web Engineering CSS. By Assistant Prof Malik M Ali

Styles, Style Sheets, the Box Model and Liquid Layout

COMM 2555: Interactive Digital Communication / Spring 2018 Lab 9: Basic layout techniques with CSS

There are 3 places you can write CSS.

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

Table Basics. The structure of an table

Parashar Technologies HTML Lecture Notes-4

Class 3 Page 1. Using DW tools to learn CSS. Intro to Web Design using Dreamweaver (VBUS 010) Instructor: Robert Lee

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

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

HTML Organizing Page Content

CSS: Layout, Floats, and More

ORB Education Quality Teaching Resources

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

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

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

Page Layout Using Tables

Client-Side Web Technologies. CSS Part II

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

ADOBE 9A Adobe Dreamweaver CS4 ACE.

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

Media Stylesheets and Navigation with CSS goodness. Webpage Design

The Importance of the CSS Box Model

CSS. Shan-Hung Wu CS, NTHU

Internet Programming 1 ITG 212 / A

CSS: Lists, Tables and the Box Model

Advanced CSS. Slava Kim

HTML and CSS COURSE SYLLABUS

What do we mean by layouts?

Word 2016: Using Section Breaks

CS193X: Web Programming Fundamentals

Block & Inline Elements

Chapter 3 CSS for Layout

subject to an additional IP rights grant found at polymer.github.io/patents.txt -->

door to my garden Simple CSS resulting in impressive, sophisticated visual effects

COMP519 Web Programming Lecture 8: Cascading Style Sheets: Part 4 Handouts

Getting Started with CSS Sculptor 3

HTML and CSS a further introduction

Layout with Layers and CSS

CSS.

Building Page Layouts

How to lay out a web page with CSS

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

HIERARCHICAL ORGANIZATION

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

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

IMY 110 Theme 7 HTML Tables

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

Cascading Style Sheets Level 2

Create a three column layout using CSS, divs and floating

CS7026 Media Queries II. Different Screen Size Different Design

CSS: formatting webpages

CSC Website Design, Spring CSS Flexible Box

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

APPLIED COMPUTING 1P01 Fluency with Technology

ID1354 Internet Applications

In this tutorial, we are going to learn how to use the various features available in Flexbox.

Using Dreamweaver CS6

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

BIM222 Internet Programming

COMSC-030 Web Site Development- Part 1. Part-Time Instructor: Joenil Mistal

Adding CSS to your HTML

Micronet International College

NAVIGATION INSTRUCTIONS

Graduating to Grid. An Event Apart Orlando

Before you begin, make sure you have the images for these exercises saved in the location where you intend to create the Nuklear Family Website.

Web Design and Development Tutorial 03

Introducing CSS Flexbox Layout

Chapter 16: PAGE LAYOUT WITH CSS

Responsive web design (RWD) CSS3 Media queries. Mobile vs desktop web sites. Web Development 1 CS1115/CS5002

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

9 POINTS TO A GOOD LINE GRAPH

DOING MORE WITH WORD: MICROSOFT OFFICE 2010

Cascading Style Sheets (CSS)

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

International Conference KNOWLEDGE-BASED ORGANIZATION Vol. XXIII No RESPONSIVE WEB DESIGN TECHNIQUES. Luminita GIURGIU, Ilie GLIGOREA

Dreamweaver: Accessible Web Sites

Assignments (4) Assessment as per Schedule (2)

Zen Garden. CSS Zen Garden

To place an element at a specific position on a page use:

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

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

Dreamweaver Tutorials Working with Tables

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

Transcription:

CSS Layout Part I Web Development

CSS Selector Examples Choosing and applying Class and ID names requires careful attention Strive to use clear meaningful names as far as possible.

CSS Selectors Summary (simple) Selector Applies to p.about #corporatehistory h1,h2,h3.privacy,.copyright #header,#footer p.footnote All paragraphs in the document All elements in the document with a class value of about The element in the document with an id value of corporate history (if present) All first-, second-, and third-level headings in the document All elements with a class of privacy or copyright The element assigned an id of header, and the element assigned an id of footer All paragraphs assigned a class of footnote 3

CSS Selectors Summary (advanced) Selector #bodycopy.usergenerated.navigation a #primarynavigation li.current.about #bodycopy body#personalproducts, body#proproducts, body#enterpriseproducts Applies to An element that has been assigned both an id of bodycopy and a class of usergenerated All links with an ancestor parent assigned a class of navigation All list items with a class of current and an ancestor parent with an id of primarynavigation Any element on the site with an id of bodycopy and an ancestor parent assigned a class of about The body elements within the site assigned the ids personalproducts, proproducts, and enterpriseproducts body#personalproducts #bodycopy, body#proproducts #bodycopy, body#enterpriseproducts #bodycopy The elements assigned an id of bodycopy, within the documents suggested by the previous example ol li ol li ol li A list item in the third level of a nested ordered list 4

Lab 06: Learn CSS Layout Part 1 5

CSS Layout I No layout The display property Margin: auto; Max-width The box model Box-sizing Position Float Clear

No Layout No layout is ok if you want one big column of content. What happens if you make the browser really wide? Your eyes have to travel a long distance right to left to the next line.

display is CSS s most important property for controlling layout. Every element has a default display value depending on what type of element it is. The default for most elements is usually block or inline. block <div> is the standard block level element. It starts on a new line and stretches to the left and right as far as it can. Others include <p> and new in HTML5 are <header> <footer> <section> and more. inline <span> is the standard inline element. The <a> element is the most common inline element. none Setting display to none will render the page as though the element does not exist. visibility: hidden; will hide the element, but the element will take up the space it would usually. display property.test-one { display:block; } test-two { display:inline; } test-three { display:none; }.test-four { visibility:hidden; }

margin: auto; Setting the width of a block-level element will stop it stretching out to the edges left and right. Then set the margin to auto left and right. This horizontally centres that element within its container. The only problem is when the browser window is narrower than the width you set. What will the browser do?

max-width To prevent a horizontal scroll bar appearing we can use the max-width property. For a site that needs to be usable on a mobile it is important to use max-width. max-width is supported by all major browsers including IE7

the box model When you set the width of an element, it can actually appear bigger because of the border and padding. These two elements have their width set the same but they end up rendered as different sizes. The solution might be to write smaller width value than we wanted

box-sizing A new CSS property called box-sizing was created for this problem. When you set box-sizing: border-box; on an element the padding and border of that element no longer increases its width. Here we have set the box-sizing: border-box; on both elements. Some authors want all elements on their pages to work this way. Use webkit- and mozprefixes to ensure all browser engines targeted.

position position property often used to make more complex layouts. Has a range of possible values, and their name can be confusing and difficult to remember. Static static is the default value. An element with position: static; is not positioned in any special way. A static element is said to be not positioned and an element with its position set to anything else is said to be positioned.

position relative relative behaves the same was as static unless you add some extra properties to adjust the element away from its normal position. Other content will not be adjusted to fit into any gap left by that element.

position fixed A fixed element is positioned relative to the viewport, which means it always stays in the same place even if the page is scrolled. As with relative the top, right, bottom, and left properties are used. A fixed element does not leave a gap in the page where it would normally have been located.

position absolute absolute is the trickiest position value. absolute behaves like fixed except relative to the nearest positioned ancestor instead of relative to the viewport. If an absolutely positioned element has no positioned ancestors, it uses the document body, and still moves along the page scrolling. This is tricky, but can be important for creating sophisticated CSS layouts.

position example

float Float can be used for wrapping text around images:

float without clear

float with clear the clear property is important for controlling the behaviour of floats. You use the value left to clear elements floated to the left. You can also clear right and both.

Except where otherwise noted, this content is licensed under a Creative Commons Attribution-NonCommercial 3.0 License. For more information, please see http:// creativecommons.org/licenses/by-nc/3.0/