CSS Layouts CH 13.

Slides:



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

LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Cascading Style Sheets (CSS): Pixel-Level Control with HTML Ease
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Client-Side Internet and Web Programming
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
Floating Elements CS380.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
© 2010, Robert K. Moniot Chapter 5 CSS : Cascading Style Sheets 1.
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.
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.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
Web Design & Development Cascading Style Sheets (CSS)
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Using HTML Tables.
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.
3.1 Cascading Style Sheets. Motto Fashions fade, style is eternal. —Yves Saint Laurent.
Cascading Style Sheets 1 Color and Backgrounds. Cascading Style Sheets 2 Color and Backgrounds Computer color basics Expression of color values using.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
Slide 1 of 83 Table Borders To specify table borders in CSS, use the border property. The example below specifies a black border for table, th, and td.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
INTRODUCTION TO HTML5 Styling Text. Change the Font Size  You can use the font-size property to change the font size for a document’s text.  Instead.
CSS – Cascading Style Sheets Fred Durao
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
THE BOX MODEL Putting layouts together with CSS. The Box Model  How would you describe a box?  Container?  Tags or elements are “containers”  puts.
XHTML HyperText Markup Language Instructs a browser how to “render”/display/format text.
CSS.
CSS for Styling By Jinzhu Gao.
CSS Box Model.
CSS Box Model.
Cascading Style Sheets Boxes
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
CSS Layouts: Grouping Elements
Creating Your Own Webpage
Webpage layout using CSS
CSS Rule Selector Declaration Block Value Attribute Name body {
Chapter 3 Style Sheets: CSS
Cascading Style Sheets
Cascading Style Sheets (Formatting)
3.5 Property Value Forms - There are 60 different properties in 7 categories: - Fonts - Lists - Alignment of text - Margins - Colors - Backgrounds - Borders.
The Internet 10/25/11 XHTML Tables
CSS Applications to XML 19-Sep-18.
Cascading Style Sheets
The Internet 10/13/11 The Box Model
Second CSS Lecture Applications to XML
MORE Cascading Style Sheets (The Positioning Model)
CSS Box Model.
Using HTML Tables SWBAT: - create tables using HTML
SEEM4570 Tutorial 3: CSS + CSS3.0
More CSS 22-Feb-19.
Floating and Positioning
CSS Box Model.
CS3220 Web and Internet Programming More CSS
Cascading Style Sheets
CSS Applications to XML 20-May-19.
CSc 337 Lecture 5: Grid layout.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
CS3220 Web and Internet Programming More CSS
Presentation transcript:

CSS Layouts CH 13

Objective CSS units The display property Box properties Positioning

Sample Property Names and Values CSS units CSS properties have names and values Sample Property Names and Values Name Value display none font-style Italic margin-top 0.5in font-size 12pt border-style solid color #CC0033 background-color white background-image url(http://www.idgbooks.com/images/paper.gif) list-style-image url(/images/redbullet.png) line-height 120%

CSS units The names are all CSS keywords Values are more diverse Some are keywords, such as none in display or solid in border-style Order values are numbers with units

CSS Units – length values Length values - length is a scalar measure used for width, height, font size, word and letter spacing, text indentation, line height, margins, padding, border widths, and many other properties Lengths are given as a number followed by the abbreviation for one of these units

CSS Units – length values Abbrevation Inches In Centimeters Cm Millimeters Mm Points Pt Picas Pc Pixel Px Ems Em Exs ex This rule says that the font used for the TITLE element should be exactly 1 centimeter high TITLE {font-size: 1cm}

CSS Units – length values The units of length are divided into three classes Absolute units—Inches, centimeters, millimeters, points, and picas Relative units—Pixels, ems, and exs Percentages

CSS Units – length values Absolute units of length - lengths can be specified as a percentage of something VERSE {font-size: 150%}

CSS Units – length values Relative units of length – CSS support three relative units for lenghts em - The width of the letter m in the current font Ex - The height of the letter x in the current font Px -The size of a pixel ( widely use in modern displays

CSS Units – length values The example below set the left and right border of the PULLQUOTE The normal purpose of ems and exs is to set a width that’s appropriate for a given font, without necessarily knowing how big the font is PULLQUOTE { border-right-width: 2em; border-left-width: 2em; border-top-width: 1.5ex; border-bottom-width: 1.5ex }

CSS Units – length values Percentage units of length VERSE {font-size: 150%}

CSS units - URL values CSS properties can have URL values, including background-image, content, and list-style-image URL can be encode in either single or double quotes DOC {background-image: url(http://www.mysite.com/bg.gif) } LETTER {background-image: url(/images/paper.gif) } GAME {background-image: url(currentposition.gif)} INSTRC {background-image: url(../images/screenshot.gif)}

CSS Units - Color values One of the most widely adopted uses of CSS is applying foreground and background colors to elements on the page Properties that take on color values include color, background-color, and border-color CSS provides four ways to specify color: by name, by hexadecimal components, by integer components, and by percentages

CSS Units - Color values CSS understands these 16 color names adopted from the Windows VGA palette by Name aqua black blue fuchsia gray green lime maroon olive purple red silver teal white yellow navy

CSS Units - Color values CSS uses a 24 bits color model and each primary color is store in 8 bits. Number can be in Decimal or hexadecimal. Color Decimal RGB Hexadecimal Percentage Pure red Rgb(255,0,0) #FF0000 Rgb(100%,0%,0%) Pure green rgb(0,255,0) # #00FF00 rgb(0%, 100%, 0%) Pure blue rgb(0,0,255) #0000FF rgb(0%, 0%, 100%) White rgb(255,255,255) #FFFFFF rgb(100%, 100%, 100%) Black rgb(0,0,0) #000000 rgb(0%, 0%, 0%) Light violet rgb(255,204,255) #FFCCFF rgb(100%, 80%, 100%)

Values for the Display Property The display property specifies which one of these an element is Values for the Display Property Block Level Inline Elements Table Parts Invisible block inline table-column None table inline-table table-cell run-in table-column-group compact table-row table-header-group table-row-group table-caption

The Display Property cont… Block elements are usually separated from other elements by line breaks before and after each one Table elements are parts of a grid Inline elements are placed one after the other in a row Block elements are more fixed and, at most, move up and down but not left and right as content is added before and after them

The Display Property - Inline elements Inline elements are laid out horizontally in a row, starting from the top of the containing box of the surrounding page or block element and moving from left to right

The Display Property - Block elements Block-level elements are laid out vertically, one on top of the other The first block is laid out in the top left corner of the containing block; then the second block is placed below it

The Display Property - None Setting display to none hides the element An element whose display property is set to None is invisible and not rendered on the screen

The Display Property - Tables Tables can be format using 10 values in CSS of the display property ✦ table ✦ inline-table ✦ table-row-group ✦ table-header-group ✦ table-footer-group ✦ table-row ✦ table-column-group ✦ table-column ✦ table-cell ✦ table-caption

The Display Property - Tables SYNOPSIS {display: table} TITLE {display: table-header} SCENE { display: table-row} ACT { display: table-row-group } LOCATION, SCENE_NUMBER { display: table-cell }

The Display Property - List items The list-style-type property The list-style-type property determines the nature of the bullet character in front of each list item Examples. See page 354 for more property ✦ disc: • ✦ circle: ° ✦ square: o ✦ decimal: 1, 2, 3, 4, 5, and so on

The Display Property - List items SYNOPSIS { display: block; margin-left: 0.5in } TITLE { display: block } ACT { display: list-item; list-style-type: none } SCENE { display: list-item; list-style-type: square }

The Display Property - image The list-style-image property You can use a bitmapped image as the bullet SCENE { display: list-item; list-style-image: url(heart.jpg); list-style-type: square }

Box properties

Box Properties cont… Content - The content of the box, where text and images appear Padding - Clears an area around the content. The padding is transparent Border - A border that goes around the padding and content Margin - Clears an area outside the border. The margin is transparent

Box properties – Margin Margin properties Margin properties control the amount of space added to the box outside its border This can be set separately for the top, bottom, right and left margins using the margin-top margin-bottom margin-right margin-left properties

Box properties – Margin Each margin can be specified as an absolute length or as a percentage of the size of the parent element’s width

Box properties - Border properties Border properties - let you specify the style, width and color of the border Border style – by default, no border is drawn around boxes regardless of the width and color of the border To make a border visible, you must change the border-style property of the box from its default value of none to one of these 10 values in the list

Box properties - Border properties Most boxes don’t have border. They are invisible rectangle Border Style ✦none—No line ✦ hidden—An invisible line that still takes up space ✦ dotted—A dotted line ✦ dashed—A dashed line ✦ solid—A solid line ✦ double—A double solid line ✦ grooved—A line that appears to be drawn into the page ✦ ridge—A line that appears to be coming out of the page ✦ inset—The entire element (not just the line around the edge) appears pushed into the do Example of how to use border http://www.w3schools.com/css/css_border.asp cument

Box properties - Border properties The border-style property can have between one and four values. As with the margin property, a single value applies to all four borders SYNOPSIS { border-style: solid } SYNOPSIS { margin: 1cm 1cm 1cm 1cm } SYNOPSIS, TITLE, ACT, SCENE { display: block } ACT { margin-top: 3ex }

Box properties - Border properties Border width Four border-width properties specify the width of the borderlines along the top, bottom, right, and left edges of the box ✦ border-top-width ✦ border-right-width ✦ border-bottom-width ✦ border-left-width SYNOPSIS { border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px }

Used to set border color ✦ border-top-color ✦ border-right-color ✦ border-bottom-color ✦ border-left-color SYNOPSIS { border-style: solid; border-width: 1px; border-color: red }

Positioning The clear property The clear property specifies whether an element can have floating elements on its sides Link to positioning http://www.w3schools.com/css/css_positioning.asp

references http://www.avajava.com/tutorials/lessons/how-do- i-style-an-xml-file-with-css.html http://www.w3schools.com/css/css_howto.asp CSS http://www.w3schools.com/css/css_boxmodel.asp How do I style an XML file with CSS http://www.avajava.com/tutorials/lessons/how-do-i-style-an-xml-file-with-css.html CSS Trick http://css-tricks.com/complete-guide-table-element/