CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today CSS Properties –Box properties-- List properties –Table properties-- Classification properties –(Audio.
Advertisements

1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Client-Side Internet and Web Programming
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
9-May-15 More CSS. 2 A different emphasis CSS is the same for XML as it is for HTML and XHTML, but-- XML contains no display information If you want your.
Today’s objectives Site performance Padding, Margins, Borders
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
CSS provides a way to stray away from the traditional methods of using tables to lay out pages. Success with this technique depends on understanding of.
Tutorial 4: Creating page layout with css
CSS: Class 1 Background Images, Controlling Position of Background Images, Add Padding to Page Elements, Add Borders to Elements on a Page.
1 Lesson Style Sheets Box Model Content (text,image,table) Margin Padding Border Box.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
Style sheets can also affect the BODY. style4.css BODY {BACKGROUND-COLOR : white} H1 {COLOR : red; FONT-SIZE : 50; FONT-FAMILY : arial} H2 {COLOR : green}
Style sheets can also affect the body. style4.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green}
14-Jul-15 CSS Applications to XML. 2 A different emphasis CSS is the same for XML as it is for HTML, but-- HTML already does a pretty good job of layout.
Selectors thru Borders. CSS – Cascading Style Sheets – is a way to style HTML HTML is the content base of a web page CSS provides the presentation qualities.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
The Missing Manual MARGINS, PADDING, & BORDERS—CHAPTER 7.
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
CSS Border.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
Chcslonline.org Text –wrapping around Images. chcslonline.org To wrap text around an image, lets set up a style in our style sheet. open a new notepad.
Part 4 Introduction to CSS. CSS Table Table Borders table, td, th { border:1px solid black; } Firstname Lastname Bader Ali Paul Manuel The example below.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
CIS234A Lecture 5 Instructor Greg D’Andrea. Font Styles Review Font-Family: generic family, font family Font-Size: em, pt, px, %, mm, cm, in Font-Style:
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Tutorial 4 Creating Page Layouts with CSS
CIS234A Lecture 6 Instructor Greg D’Andrea. Span and Div The span and div elements are a generic means by which we can add structure to documents. The.
CSS Table Styling. Up to this point, as we haven't applied any CSS styling to our tables, our example tables have not been too pleasing to the eye. CSS.
CSS Box Model. What is the Box Model? Each XHTML element appearing on our page takes up a "box" or "container" of space. Each box size is affected not.
End User Computing Applied CSS: Building our course homepage Sujana Jyothi Department of Computer Science
CIS 228 The Internet 10/18/11 Grouping XHTML. CSS Selectors Rule: selector-group { property-declaration* } Selector-group: selector *, Selector: simple-selector.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
CSS. What does it stand for? ___________________.
CSS Box Model.
CSS Box Model.
The Box Model in CSS Web Design – Sec 4-8
Cascading Style Sheets Boxes
CSS Layouts CH 13.
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
The Box Model in CSS Web Design – Sec 4-8
CSS Layouts: Grouping Elements
>> The “Box” Model
The Box Model in CSS Web Design – Sec 4-8
CSS Applications to XML 19-Sep-18.
Cascading Style Sheets
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Second CSS Lecture Applications to XML
CSS Box Model.
More CSS Page layout Boriana Koleva Room: C54
More CSS 22-Feb-19.
CSS Box Model.
CSS Boxes CS 1150 Fall 2016.
CSS Applications to XML 20-May-19.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
Presentation transcript:

CSS The Definitive Guide Chapter 8

 Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more

 Set elements apart from others  Accentuate its appearance  Mark certain kinds of data as having been changed  Or any other number of other things

 Is defining regions around an element that control how the border is placed in relation to the content and how close other elements can get to that border.  In short the area between an element and its border is the padding.

 Is that area that is beyond the border

 All of these properties affect how the entire document is laid out and affect the appearance of a given document!

All documents generate a rectangular box called the element box. Each box influences the position and layout of other element boxes. By default boxes do not overlap each other so that they are visually rendered correctly.

 The width of an element is defined as the distance from the left inner edge to the right inner edge and the height is the distance from the inner top to the inner bottom  Let check out some examples at w3schools.com w3schools.com

 The separation between most normal-flow elements occurs because of element margins.  Setting a margin creates extra “blank space” around an element.  “Blank space” refers to an area in which other elements cannot also exist and in which the parent element’s background is visible. Look at page 211 paragraphs with and without margins.

 Can accept any length of measurement, pixels, inches, millimeters, or ems.  Default value is 0 (zero)  Browsers come with pre-assigned styles for many elements and that is the same with margins. In CSS-enabled browsers margins generate a “blank line” above and below the paragraph element.  You must declare margins for the p element if you don’t want the browser to apply the default.

p { background-color: silver; margin: 10px; } 10 pixels of space have been added to each side of the content area.

img { margin: 1em; } This would put 1 em of space surrounding all images.

1em is equal to the current font size. 2em means 2 times the size of the current font. if an element is displayed with a font of 12 pt, then '2em' is 24 pt. The 'em' is a very useful unit in CSS, since it can adapt automatically to the font that the reader uses.

What if you wanted different spaces on each side of an element. That can be done as well. H1 {margin: 10px 20px 15px 5px; } The order is important! margin: top right bottom left The four values go clockwise = TRBL

Percentages are computed in relation to the width of the parent element, so they change if the parent element’s width changes in some way. Also margins can mix percentages with length values: h1 {margin: 0.5em 10% 0.5em 10%; }

p {margin; 0.25em 1em 0.25.em 1em; } Can be the same as: p {margin: 0.25em 1em; } The two values are enough to make the four.  If the value left is missing, use the value provided for right.  If the value for bottom is missing, use the value provided for top.  If the value for right is missing, use the value provided for top.

It is possible to set a margin on one side only. h2 {margin-left: 3em;} Or maybe two sides h2 {margin-left 3em; margin-bottom: 2em;}

Combining negative and positive margins can be useful. Paragraphs can be made to “punch out” of a parent element. A creative way to display text.

Inside the margins are the borders. The border of an element is one or more lines that surround the content and padding of an element. The background of the element will stop at the out border edge. Background does not extend into the margins, thus the border is just inside the margin.

Every border has three aspects 1.width or thickness 2.Style or appearance 3.Color Default width value = medium (usually 2 pixels) Default style is zero. If a border has no style it doesn’t exist. Default color value is foreground color of the element itself. If no color is declared for the border, it will be the same color as the text.

Without border styles there would be no borders. In CSS there are 10 distinct non-inherit styles for the property border-style. None | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset | {1.4} | inherit

It is possible to define more than one style for a given border. p.new1 {border-style: solid dotted dashed solid;}

The border-color property sets the color of an element's four borders. This property can have from one to four values. Examples: border-color: red green blue pink; top border is red right border is green bottom border is blue left border is pink border-color: red green blue; top border is red right and left borders are green bottom border is blue border-color: red green; top and bottom borders are red right and left borders are green border-color:red; all four borders are red ◦ Note: Always declare the border-style property before the border-color property. An element must have borders before you can change the color.

Try coding border-style and border-color

 Padding for the element box is between the borders and content area.  Accepts any length value or percentage value. If all h1 elements are to have 10 pixels of padding on all sides it would be written as: h1 {padding: 10px; background-color: silver;}

By default elements have no padding.

The ability to apply margins, borders and padding to any element is one of the things that sets CSS so far above traditional web markup.

 Please have one of your h1 elements have a different space on each side using the margin values of your choice. (must have 4 values TRBL)  Please make at least two of your headings have a different color and different style.  Please also use padding in your code.  Please use a border around one of your paragraphs. Please use the 3 attributes of the border. (with, style, color)  Please provide comments with including date of coding as today’s date.