Web Programming Language

Slides:



Advertisements
Similar presentations
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Advertisements

Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
Today CSS HTML A project.
CSS CSS stands for Cascading Style Sheets Styles define how to display HTML elements External Style Sheets can save a lot of work External Style Sheets.
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.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
CSS(Cascading Style Sheets )
กระบวนวิชา 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.
Web Programming Language Dr. Ken Cosh Week 2 (CSS I)
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
Cascading Style Sheets (CSS). A style sheet is a document which describes the presentation semantics of a document written in a mark-up language such.
1 Cascading Style Sheets
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Cascading Style Sheets
Cascading Style Sheet.
CSS for Styling By Jinzhu Gao.
Internal Style Sheets External Style Sheets
CS3220 Web and Internet Programming CSS Basics
Website Development Cascading Style Sheets
Web Programming Language
CSS: Cascading Style Sheets
4.01 Cascading Style Sheets
( Cascading style sheet )
Semester - Review.
Unit 3 - Review.
Creating Your Own Webpage
Cascading Style Sheets
Cascading Style Sheets
Cao Yuewen SEEM4570 Tutorial 03: CSS Cao Yuewen
Introduction to the Internet
Cascading Style Sheets
Madam Hazwani binti Rahmat
Web Developer & Design Foundations with XHTML
Cascading Style Sheets contd: Embedded Styles
Programming the Web using XHTML and JavaScript
Cascading Style Sheet (CSS)
Cascading Style Sheets
CASCADING STYLE SHEET CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets: Basics
CSS Cascading Style Sheets
Introduction to Web programming
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Cascading Style Sheets
محمد احمدی نیا CSS محمد احمدی نیا
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets (CSS)
CSS مظفر بگ محمدی.
Tutorial 3 Working with Cascading Style Sheets
CS3220 Web and Internet Programming CSS Basics
Part 1: Cascading Style Sheets
CS3220 Web and Internet Programming CSS Basics
Cascading Style Sheets
Cascading Style Sheets
4.01 Cascading Style Sheets
External Style Sheets.
Web Client Side Technologies Raneem Qaddoura
Cascading Style Sheets
Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
Cascading Style Sheets
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Web Programming Language Chapter 2

CSS For Style Why Use CSS? Introducing CSS Selectors <Span> & <Div> Where to CSS? More on Selectors CSS Properties

CSS – Cascading Style Sheets Separating Style From Content Consider if your site grows and has 100 pages – and then you need to make a design change… A style is the definition of the form that something takes; Color, Font, Size, Italics, Bold, Underline, Width, Height, Position… Each Style is defined in a Selector

Advantages of Using CSS Separation of form & content Define the look of pages in one place Easily change the look of pages Define more font attributes than the standard tags Position elements with pixel precision Redefine entire HTML tags Define custom styles for links (not just a blue underline) Define layers, so elements can appear on top of other elements

Styling a Table

<table> <tr> <td bgcolor="#eeeeee" align="left"> <font face="arial" size="4" color="blue"><b>uk</b></font> </td> <td bgcolor="#dddddd" align="center"> <font face="arial" size="2" color="black"><i>United Kingdom</i> </td> </tr> <tr> <td bgcolor="#eeeeee" align="left"> <font face="arial" size="4" color="blue"><b>us</b></font> </td> <td bgcolor="#dddddd" align="center"> <font face="arial" size="2" color="black"><i>United States</i> </td> </tr> <tr> <td bgcolor="#eeeeee" align="left"> <font face="arial" size="4" color="blue"><b>th</b></font> </td> <td bgcolor="#dddddd" align="center"> <font face="arial" size="2" color="black"><i>Thailand</i> </td> </tr> </table> Your Thoughts? N.B. Font tag is deprecated

How about this? <table> <tr><td class="col1">uk</td> <td class="col2">United Kingdom</td></tr> <tr><td class="col1">us</td> <td class="col2">United States</td></tr> <tr><td class="col1">th</td> <td class="col2">Thailand</td></tr> </table>

Defining the Styles <style> .col1 { background-color:#eeeeee; text-align:left; font-family:Arial, Helvetica, sans-serif; font-size:18px; color:blue; font-weight:bold; } .col2 { background-color:#dddddd; text-align:center; font-family:Arial, Helvetica, sans-serif; font-size:12px; color:black; font-style:italic; } </style>

Simple Style Definition <html> <head> <style type="text/css"> B.headline { color:red; font-size:22px; font-family:arial; text-decoration:underline } </style> </head> <body> <b>This is normal bold</b><br> <b class="headline">This is headline style bold</b> </body> </html>

Selectors HTML Selectors Class Selectors ID Selectors Redefine the style of existing HTML Tags Class Selectors Define styles that may appear several times across a site ID Selectors Define styles of unique elements

HTML Selectors HTMLSelector { Property:Value; } <style type=”text/css”> B { font-family:arial; font-size:14px; color:red; } </style>

Class Selectors .ClassSelectorName { Property: Value; } <html><head> <style type="text/css"> .title {font-family:arial; font-size:14px; color:red} </style> </head><body> <b class="title">This is a bold tag carrying the title class</b> <i class="title">This is an italics tag carrying the title class</i> </body></html>

ID Selectors #IDSelectorName { Property: Value; } <style type="text/css"> #layer1 {position:absolute; left:100; top:100; z-Index:0; background-color:#FF9} #layer2 {position:absolute; left:120; top:120; z-Index:1; background-color:#6CC} </style>

<div> <div ID="layer1"> THIS IS LAYER 1<br>POSITIONED AT 100,100 </div> <div ID="layer2"> THIS IS LAYER 2<br>POSITIONED AT 140,140 </div>

<span> & <div> Dummy Tags that can be used to carry css styles. <span> is an in-line tag, so no line-breaks are inserted around it. <div> is a block tag, so by default a line-break is inserted around the <div>

Where to CSS? In a tag? In the head? In an external Style Sheet? It is <b style="font-size:16px;">NOT</b> me. In the head? Makes the style available throughout the page In an external Style Sheet? Loaded once, the first time the user visits your site. Keeps styles consistent across a site. Referenced in the page header. <link rel=”stylesheet” href=”mystyle.css” type=”text/css”>

Grouping Selectors Consider this:- Or this:- .heading { font-family:arial; color:red; background:blue; font-size:14pt; } .subheading { font-family:arial; color:red; background:blue; font-size:12pt; } .details { font-family:arial; color:red; background:blue; font-size:10pt; } Or this:- .heading, .subheading, .details { font-family:arial; color:red; background:blue; } .heading { font-size:14pt; } .subheading { font-size:12pt; } .details { font-size:10pt; }

Context Sensitive Selectors How about this? B I {font-size:16px; } Or this? B I, .heading, B .subheading { font-size:16px; }

CSS & Color Colors can be specified by name, by Hex value, or by RGB. color: red; color: #FF0000 color: rgb(255,0,0)

CSS & Text Property Values Notes color Any color name, HEX or RGB value To be W3C compliant, if you set a font’s color, you should also define the background-color property text-align left, center, right, justify left is the default text-decoration none, overline, line-through, underline Setting text-decoration to none is a useful way of removing the default underline from links text-transform uppercase, lowercase, capitalize   text-indent Value in pixels Indents the first line of text direction rtl rtl stands for right to left letter-spacing word-spacing line-height

CSS & Links Removing the blue line? But do you want it to stand out? a:link {text-decoration: none; } But do you want it to stand out? a:link { color: #000000; } a:visited { color: #404040; } a:hover { color: #8c8c8c; } a:active { color: #bfbfbf; }

Key Points CSS is used to control the style of a website; all aspects of the presentation including layout, colors and fonts. Existing HTML selectors can be redefined to make them appear differently, while new styles can be created using either class or ID selectors. ID selectors should be used when there is an element that will only occur once, while class selectors are used for styles that occur multiple times. Class selectors are defined using a dot “.”, while ID selectors are defined using a hash “#”. <Span> and <Div> are dummy tags that can be used to invoke style, while not really doing anything themselves – the difference is that the <Div> tag will insert a line break around it. CSS can be defined either within a single tag, within the head of a page, or in a separate stylesheet.