CSS Box Model. Cascading Style Sheets

Similar documents
Building Page Layouts

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

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

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

Client-Side Web Technologies. CSS Part II

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

Internet Programming 1 ITG 212 / A

Appendix D CSS Properties and Values

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

What is the Box Model?

Parashar Technologies HTML Lecture Notes-4

ITNP43: HTML Lecture 5


CSS Cascading Style Sheets

Assignments (4) Assessment as per Schedule (2)

Web Design and Implementation

BIM222 Internet Programming

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

Styles, Style Sheets, the Box Model and Liquid Layout

Cascading Style Sheets CSCI 311

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

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

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

Basic CSS Lecture 17

Cascading Style Sheet Quick Reference

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

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

Controlling Appearance the Old Way

Page Layout Using Tables

Creating Layouts Using CSS. Lesson 9

CSC309 Programming on the Web week 3: css, rwd

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

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

Web Engineering CSS. By Assistant Prof Malik M Ali

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

Chapter 3 Style Sheets: CSS

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

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

COMS 359: Interactive Media

Graphic Design with CSS

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

CSS: Lists, Tables and the Box Model

BORDER IMAGES THE BACKGROUND IMAGE PROPERTIES. Learning Web Design, 5e

The Importance of the CSS Box Model

The CSS Box Model. Motivation. CSS Box Model. CSE 190 M (Web Programming), Spring 2008 University of Washington

Web Design and Development Tutorial 03

First Diploma Unit 10 Client Side Web. Week 4 -The CSS Box model

What do we mean by layouts?

IDM 221. Web Design I. IDM 221: Web Authoring I 1

COSC 2206 Internet Tools. CSS Cascading Style Sheets

HTML/XML. HTML Continued Introduction to CSS

Color. How to specify colors Color terminology and contrast Background color

ICT IGCSE Practical Revision Presentation Web Authoring

Table of Contents. MySource Matrix Content Types Manual

HTMLnotesS15.notebook. January 25, 2015

Control the letters in a text

CASCADING STYLESHEETS

Adding CSS to your HTML

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

CSS Styles Quick Reference Guide

ICT IGCSE Practical Revision Presentation Web Authoring

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

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Cascade Stylesheets (CSS)

Chapter 1 Introduction to Dreamweaver CS3 1. About Dreamweaver CS3 Interface...4. Creating New Webpages...10

More CSS. <link href="filename" type="text/css" rel="stylesheet" /> CS380

CSCU9B2: Web Tech Lecture 3

Reading 2.2 Cascading Style Sheets

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

Creating and Building Websites

CSS: Cascading Style Sheets

Positioning in CSS: There are 5 different ways we can set our position:

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

Decorating with CSS. Cool Ways to Make Things Pretty. R. Scott Granneman. Jans Carton

CS7026 CSS3. CSS3 Graphics Effects

Tutorial 3: Working with Cascading Style Sheets

Module 2 (VII): CSS [Part 4]

Part 3: Images & form styling NOMZAMO S WEBSITE

Creating Web Pages with SeaMonkey Composer

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

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

Universal CSS Navigation Menu: Advanced Styling Patrick Julicher Universal CSS Navigation Menu: Advanced Styling

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

CSS Cheat Sheet Version: 10 Last revision date:

CSS.

Cascading Style Sheets

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

CSS for Designers. Capabilities to Know & Pitfalls to Avoid. R. Scott Granneman. Jans Carton

CSS: The Basics CISC 282 September 20, 2014

CMPT 165: More CSS Basics

Create a three column layout using CSS, divs and floating

Block & Inline Elements

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

Navigation. Websites need a formalized system of links to allow users to navigate the site

FLOATING AND POSITIONING

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

Transcription:

CSS Box Model Cascading Style Sheets

CSS box model Background Width & height Margins & padding Borders Centering content Changing display type (block vs. inline)

The Box Model

Background Properties Property background Description A combined shorthand property that allows you to set the background values in one property. While you can omit properties with the short-hand, do remember that any omitted properties will be set to their default value. background-attachment Specifies whether the background image scrolls with the document (default) or remains fixed. Possible values are: fixed, scroll. background-color background-image Sets the background color of the element. Specifies the background image (which is generally a jpeg, gif, or png file) for the element. Note that the URL is relative to the CSS file and not the HTML. CSS3 introduced the ability to specify multiple background images. background-position Specifies where on the element the background image will be placed. Some possible values include: bottom, center, left, and right. You can also supply a pixel or percentage numeric position value as well. When supplying a numeric value, you must supply a horizontal/vertical pair; this value indicates its distance from the top left corner of the element. background-repeat Determines whether the background image will be repeated. This is a common technique for creating a tiled background (it is in fact the default behavior). Possible values are: repeat, repeat-x, repeat-y, and no-repeat. background-size New to CSS3, this property lets you modify the size of the background image.

Background Repeat

Background Position

Width and Height div { height: 300px; width: 400px; background-color: pink;} p { height: 75%; width: 75%; background-color: grey;}

Width and Height

Width and Height Only block-level elements and non-text inline elements such as images have a width and height that you can specify. By default the width of and height of elements is the actual size of the content. For text, this is determined by the font size and font face; For images, the width and height of the actual image in pixels determines the element box s dimensions.

Width and Height Since the width and the height refer to the size of the content area, by default, the total size of an element is equal to not only its content area, but also to the sum of its padding, borders, and margins.

BORDER, MARGIN, PADDING BORDER MARGIN PADDING

Margins and Padding

Margins Did you notice that the space between paragraphs one and two and between two and three is the same as the space before paragraph one and after paragraph three? This is due to the fact that adjoining vertical margins collapse.

Borders Borders provide a way to visually separate elements. You can put borders around all four sides of an element, or just one, two, or three of the sides.

Borders Property border Description A combined shorthand property that allows you to set the style, width, and color of a border in one property. The order is important and must be: border-style border-width border-color border-style Specifies the line type of the border. Possible values are: solid, dotted, dashed, double, groove, ridge, inset, and outset. border-width The width of the border in a unit (but not percents). A variety of keywords (thin, medium, etc) are also supported. border-color border-radius border-image The color of the border in a color unit. The radius of a rounded corner. The URL of an image to use as a border.

Shortcut notation With border, margin, and padding properties, there are long-form and shortcut methods to set the 4 sides border-top-color: red; /* sets just the top side */ border-right-color: green; /* sets just the right side */ border-bottom-color: yellow; /* sets just the bottom side */ border-left-color: blue; /* sets just the left side */ border-color: red; /* sets all four sides to red */ border-color: red green orange blue; /* sets all four sides differently */ When using this multiple values shortcut, they are applied in clockwise order starting at the top. Thus the order is: top right bottom left.

BORDER WIDTH border-width p.one { border-width: 2px;} p.two { border-width: thick;} p.three { border-width: 1px 4px 12px 4px;}

BORDER STYLE border-style p.one {border-style: solid;} p.two {border-style: dotted;} p.three {border-style: dashed;} p.four {border-style: double;} p.five {border-style: groove;} p.six {border-style: ridge;} p.seven {border-style: inset;} p.eight {border-style: outset;}

BORDER COLOR border-color p.one { border-color: #0088dd;} p.two { border-color: #bbbbaa #111111 #ee3e80 #0088dd;}

BORDER SHORTHAND border p { width: 250px; border: 3px dotted #0088dd;}

CSS3: ROUNDED CORNERS border-radius p { border: 5px solid #ee3e80; padding: 20px; width: 275px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px;}

CENTERING CONTENT body { text-align: center;} p { width: 300px; padding: 50px; border: 20px solid #0088dd;} p.example { margin: 10px auto 10px auto; text-align: left;}

CENTERING CONTENT body { text-align: center;} p { width: 300px; padding: 50px; border: 20px solid #0088dd;} p.example { margin: 10px auto 10px auto; text-align: left;}

CHANGE INLINE / BLOCK display li { display: inline-block; margin-right: 10px;}