>> CSS Layouts.

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

Cascading Style Sheets
Layout using CSS. Using multiple classes In the head:.important{font-style:italic;}.title{color:red;} In the body: Here's a type of paragraph that is.
INTRODUCTORY Tutorial 7 Creating Liquid Layouts. XP Objectives Discern the differences among various types of layouts Create a liquid layout Create a.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
Diliev.com & pLOVEdiv.com  DIliev.com.
กระบวนวิชา 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.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Chapter 7 Using Advanced Cascading Style Sheets HTML5 & CSS 7 th Edition.
Lecture Cascading Style Sheets (CSS) Internal Style Sheets Classes.
4.01 Cascading Style Sheets
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
TUTORIAL 8: Enhancing a Web Site with Advanced CSS
Creating A Simple Web Page. Step 1- Open Dreamweaver & Create A New Page (File New) and blank.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
Principles of Web Design 6 th Edition Chapter 7 – Page Layouts.
ITP 104.  While you can do things like this:  Better to use styles instead:
The Characteristics of CSS
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
>> 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.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
Web Design Part I. Click Menu Site to create a new site root.
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
>> CSS Layouts. Recall Properties of Box – Border (style, width, color) – Padding – Margin – Display – Background – Dimension Welcome Padding Area Border.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
Cascading Style Sheets for layout
CSS.
Cascading Style Sheets (CSS) Internal Style Sheets Classes
Cascading Style Sheets Layout
Create and edit web pages 4
>> Navigation and Layouts in CSS
4.01 Cascading Style Sheets
CSS Layouts: Positioning and Navbars
Google fonts CSS box model
CSS Layouts: Grouping Elements
>> Introduction to CSS
CS1220 Web Programming Saloni Chacha.
>> The “Box” Model
Creating Page Layouts with CSS
Box model.
Cascading Style Sheets (Layout)
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Styles and the Box Model
Controlling Layout with Style Sheets
CSS Borders and Margins.
CSS Box Model.
MORE Cascading Style Sheets (The Positioning Model)
CSS and Box Model.
>> Dynamic CSS Selectors
Float Property Elements that seem to “float" on the right or left side of either the browser window or another element are often configured using.
Web Development & Design Foundations with H T M L 5
Web Development & Design Foundations with H T M L 5
Training & Development
Floating and Positioning
CSS and Class Tools.
4.01 Cascading Style Sheets
Cascading Style Sheets
Web Client Side Technologies Raneem Qaddoura
The div Element and CSS for layout
CSc 337 Lecture 5: Grid layout.
Web Programming and Design
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

>> CSS Layouts

Welcome Recall Properties of Box Border Area Padding Area Content Area Margin Area Border Area Padding Area Welcome Content Area Properties of Box Border (style, width, color) Padding Margin Display Background Dimension

Web-Based Systems - Misbhauddin Page Margin Most websites online are centered How can we do this? Wrap the whole body inside a wrapper (like a candy) And then play with the margin values of the wrapper Web-Based Systems - Misbhauddin

<div id=“wrapper”> <div id=“header”></div> <div id=“sidebar”> </div> <div id=“content”></div> <div id=“footer”></div> </div> Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Pre-requisite Download the css_layout.zip file Unzip the file Open the css_layout.html file in the editor Create a new css file called style.css and save it inside the css folder Link the css inside the html file using <link> tag. Note: The output_css_layout.png file includes the requirements for the final output – color, size, margin and so on Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Centering the Wrapper #wrapper { margin: 0 auto; } Note: This will not work until you define a width for the wrapper. Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Issue with using width #wrapper { width: 900px; margin: 0 auto; } What will happen when the browser window is smaller than the width of your wrapper? CHECK IT NOW – RESIZE YOUR BROWSER WINDOW HOW CAN WE AVOID THAT? Web-Based Systems - Misbhauddin

Use max-width property instead of width TRY NOW Edit CSS Use max-width property instead of width Will improve the browser's handling of small windows This is important when making a site usable on mobile Web-Based Systems - Misbhauddin

TRY NOW Edit CSS Add all the background-colors for the body and the div tags Change the text colors of all the items Use proper text-align for all items Change the font-size of the h1 element Web-Based Systems - Misbhauddin

Use height and width property (Dimension) TRY NOW Edit CSS Resize the three DIV inside the “About” div tag according to the size provided Use height and width property (Dimension) Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Box Model Issue When you specify the width and height of an element:  the element can actually appear bigger than what you set.  Reason: The element's border and padding will stretch out the element beyond the specified width .advanced { width: 290px; padding: 30px; border-width: 10px; } .simple { width: 290px; } Web-Based Systems - Misbhauddin

MATH Hence, you will need to do some math. And for some (or maybe many) MATH is not fun Solution: CSS provides another property called “box-sizing” and if you set its value to “border-box” the padding and border of that element no longer increase its width .advanced { width: 290px; box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; padding: 30px; border-width: 10px; } Box-Sizing is a new property. It is not supported by all browsers. That is why we add these. They are called Vendor Prefixes -moz- => Mozilla based browsers -webkit- => For Webkit based such as Safari Web-Based Systems - Misbhauddin

How to make the three DIV inline Solution 1 Use display inline Not really. Remember what happened in the last class Use float What is float? Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Column Layouts 400px This is a block of random text created to show the usage of an important property in CSS which allows creating of 2-3 column layouts which are among the most popular layouts in web design. This property is called “Float”. What this property does is that it makes the element just simply float on the browser space. But using this property can be tricky. You need to set the width, margins and paddings appropriately to align them correctly together to finally come as a column layout. <div id=“para1”> …….. </div> <div id=“para2”> …….. </div> Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Column Layouts 400px This is a block of random text created to show the usage of an important property in CSS which allows creating of 2-3 column layouts which are among the most popular layouts in web design. This property is called “Float”. What this property does is that it makes the element just simply float on the browser space. But using this property can be tricky. You need to set the width, margins and paddings appropriately to align them correctly together to finally come as a column layout. #para1 { width: 200px; } #para2 { width: 200px; } <div id=“para1”> …….. </div> <div id=“para2”> …….. </div> Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Column Layouts 400px This is a block of random text created to show the usage of an important property in CSS which allows creating of 2-3 column layouts which are among the most popular layouts in web design. This property is called “Float”. What this property does is that it makes the element just simply float on the browser space. But using this property can be tricky. You need to set the width, margins and paddings appropriately to align them correctly together to finally come as a column layout. #para1 { width: 200px; float: left; } #para2 { width: 200px; float: right; } <div id=“para1”> …….. </div> <div id=“para2”> …….. </div> Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Float Issue This is a block of random text created to show the usage of an important property in CSS which allows creating of 2-3 column layouts which are among the most popular layouts in web design. This property is called “Float”. What this property does is that it makes the element just simply float on the browser space. But using this property can be tricky. You need to set the width, margins and paddings appropriately to align them correctly together to finally come as a column layout. <div id=“container”> <div id=“para1”> …….. </div> <div id=“para2”> …….. </div> </div> #container { border 1px solid black; } #para1 { width: 200px; float: left; } #para2 { width: 200px; float: right; } Web-Based Systems - Misbhauddin

Web-Based Systems - Misbhauddin Floats Issue – “Clear” This is a block of random text created to show the usage of an important property in CSS which allows creating of 2-3 column layouts which are among the most popular layouts in web design. This property is called “Float”. What this property does is that it makes the element just simply float on the browser space. But using this property can be tricky. You need to set the width, margins and paddings appropriately to align them correctly together to finally come as a column layout. The clear div specifying the end of floating elements #clear { clear: both;} <div id=“container”> <div id=“para1”> …….. </div> <div id=“para2”> …….. </div> <div id=“clear”></div> </div> #para1 { width: 200px; float: left; } #para2 { width: 200px; float: right; } #container { border 1px solid black; } Web-Based Systems - Misbhauddin

TRY NOW Edit CSS File Use float to align the columns in one line Use a clear div within the About Div Web-Based Systems - Misbhauddin

Set the display property of the container (About Div) as inline-block; Want to make it easier? Using inline-block Set the display property of the container (About Div) as inline-block; No need for clear div anymore

Next on Web-based Systems Cascading Style Sheets Navigation in CSS