Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.

Slides:



Advertisements
Similar presentations
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Advertisements

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.
Cascading Style Sheets Part 3 Fall, 2007 Modified by Linda Kenney Nov. 12, 2007.
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
CSS II Digital Media: Communication and design IT University of Copenhagen.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
MORE Cascading Style Sheets (The Positioning Model)
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.
CSS Margins. The Margin properties define the space around elements. It is possible to use negative values to overlap content. The top, right, bottom,
Cascading Style Sheets – Block Level. Block Level Style So far we have done text-level CSS With block level CSS, we used a generic container tag Similarly.
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.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
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.
Principles of Web Design 6 th Edition Chapter 10 – Data Tables.
CSS Introduction Cascading Style Sheets Provides a great deal of control over the presentation of the document HTML indicates both semantics of a document.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
CSS Netcentric. What is CSS O CSS stands for Cascading Style Sheets O Styles define how to display HTML elements O Styles were added to HTML 4.0 to solve.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 10: A Deeper Look at CCS- Spring 2011.
COMP213 – Web Interface Design
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.
Floating Elements CS The CSS float property (reference) 2 img.headericon { float: right; width: 130px; } CSS  removed from normal document flow;
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Svetlin Nakov Telerik Corporation
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.
Layout with Styles Castro Chapter 11. Tables vs. CSS You can produce “liquid layouts” (layouts that stretch as the browser is resized) using tables or.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
Cascading Style Sheets (CSS) Part II IT210: Web-based IT.
CONTROLLING Page layout
Extra-simplified.  Only truly happen when the CSS and HTML are defined as separate files (external style sheet) Introduction The main idea of CSS is.
Tutorial 4 Creating Page Layouts with CSS
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations SlideSet #5: Advanced CSS.
CSS - Quiz #3 Lecture Code:
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
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 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
Ch 11 HTML and CSS Web Standards Solutions A Web Standardistas’ Approach.
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,
CHAPTER 15 Floating and Positioning. FLOAT VS. POSITION  Floating an element moves it to the left or right, allowing the following text to wrap around.
Laying out Elements with CSS
CSS Layouts: Grouping Elements
Webpage layout using CSS
CSS Borders and Margins.
MORE Cascading Style Sheets (The Positioning Model)
Floating and Positioning
Laying out Elements with CSS
Positioning Boxes Using CSS
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1

The CSS Box Model ● All printable HTML elements can be represented as rectangular boxes ● Each box consist of the following spaces: Content Area: displays the actual text/graphic Padding: spaces surrounding the content area Border: Surrounds contents and padding Margin: spaces to separate an element from other adjacent elements or its container

The CSS Box Model Content Padding Border Margin

The CSS “containing element” Each element has an associated containing element “each box sits inside some bigger box” Only block level elements(,,.. etc) or the webpage itself( tag) are considered as containing element In case of multiple block-level nesting, the containing element of a box/element will be the closest block level element Will be referred as simply ‘container’

CSS Width and height properties height : [length units] width : [length units] Used to set width and height of the Content Area of an Element div{ height: 100px; width: 300px; } Length values can be absolute(in,cm,mm,px) or % of the height/width of its container

CSS Padding properties padding-top : [length units] padding-right : [length units] padding-bottom : [length units] padding-left : [length units] Shorthand expression: padding: [top][right][bottom][left] Start from top and go clockwise

CSS Margin properties margin-top : [length units] margin-right : [length units] margin-bottom : [length units] margin-left : [length units] Similar to padding, property margin can set all 4 values in top-right-bottom-left sequence

CSS Borders border-style : [ none/hidden/dotted/dashed/solid/double/groove/ridge/inset/outset] To Add style to specific side of a border: border-top-style,border-bottom-style.. border-color: [color value] Similarly, border-top-color, border-left-color etc. border-width: [length units] Applies uniform width to all four borders. Customizable Shorthand expression: border: [border-width value] [border-style value] [border-color value]

CSS Borders border-collapse : [ collapse/separate] Applies to Table elements If separate, adjacent cells each have their own distinct borders. If collapsed, adjacent table cells share borders.

Default HTML Layout By default, all visible elements of a web page is displayed in the same sequence they are written in HTML Page width filled from left to right, then height filled from top to bottom

HTML vs CSS Positioning How to design multi-column layouts on a web page? Use Add content blocks as table data not recommended Alternatively, use CSS positioning properties

CSS float Property float : [left/right/none] Places the selected element at the left or right side of its container Other texts and inline elements of the container will wrap around it Widely used

CSS float Property By default, block-level elements occupy the entire available width of its container Try printing a small with a background color! Replace with and compare! To make the block–level elements float, it should be ‘shrunk’ by setting appropriate width property

CSS float Property #div1 { float:right; width:300px; height:300px; background-color:red; border-style:solid" } floated text Loren ipsum …. laborum

CSS clear Property clear : [left/right/both] Prevents placement of floating element on the [left/right/both] side of the selected element Useful to clear past floating elements and resume normal flow

CSS clear Property #para2{ clear:both; border-style:solid; border-color:blue } floated text Loren ipsum …. Pariatur Instead of …it’s right

CSS position property position : [static|absolute|fixed|relative] Position value static suggests default, normal flow. To use absolute/fixed/relative option, one or two of the following must be set: top : [length units] bottom : [length units] left : [length units] right : [length units] Specifies exact placement location for the selected element

CSS position property(contd.) absolute: Positioning values measured from the edge of the entire HTML document fixed: Positioning values are calculated from the edge of the viewport. User always sees a fixed element in the same location of his page view Relative: Positioning values are calculated from the edges of the nearest positioned container Example: