CSS Classes.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Computer Applications II.  A Style Sheet is a web page development tool that allows the developer to make global changes to a web page (or web site)
HTML: HyperText Markup Language Hello World Welcome to the world!
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
Introduction to CSS.
CHAPTER 8 ADVANCED CSS. LEARNING OBJECTIVES Assign formatting styles to a CSS class definition Use a tag’s class attribute to apply the styles defined.
4.01 Cascading Style Sheets
Review HTML  What is HTML?  HTML is a language for describing web pages.  HTML stands for Hyper Text Markup Language  HTML is not a programming language,
Chapter 12 Creating and Using XML Documents HTML5 AND CSS Seventh Edition.
Cascading Style Sheets Dreamweaver. Styles Determine how the HTML code will display Determine how the HTML code will display Gives designers much more.
STYLING THE WEBSITE - EXTERNAL CSS BY JORGE MARTINEZ.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
1 WDMD 170 – UW Stevens Point WDMD 170 Internet Languages eLesson: CSS Introduction to Style Sheets (NON-audio version) © Dr. David C. Gibbs
1 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles are normally stored in Style Sheets  Styles.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
XP Mohammad Moizuddin Creating Web Pages with HTML Tutorial 1 1 New Perspectives on Creating Web Pages With HTML Tutorial 1: Developing a Basic Web Page.
Introduction To CSS.. HTML Review What is HTML used for? Give some examples of formatting tags in HTML? HTML is the most widely used language on the Web.
STILL CHAPTER 4 More Style. Topics How to specify “style” for beautifying your content?  Using tag and style attributes and values Separate file for.css.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Lesson 2 Adding more content to your web page. Thanks to Richard Hudnutt, Luella HS.
Introduction to HTML. What is HTML? Hyper Text Markup Language (HTML) is a language for describing web pages. HTML is not a programming language, it is.
INTRODUCTION TO CSS. OBJECTIVES: D EFINE WHAT CSS IS. K NOW THE HISTORY OF CSS. K NOW THE REASON WHY CSS IS USED. CSS SYNTAX. CSS ID AND CLASS.
CSS CSS is short for C ascading S tyle S heets. It is a new web page layout method that has been added to HTML to give web developers more control over.
CSS Basic (cascading style sheets)
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
IS1825: Developing Multimedia Applications for Business Lecture 1: Introduction to CSS Rob Gleasure
XP 2 HTML Tutorial 1: Developing a Basic Web Page.
HTML Structure & syntax. Introduction This presentation introduces the following: Doctype declaration HTML Tags, Elements and Attributes Sections of a.
1 HTML Frames
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
HTML GUIDE Press F5 and then Click on the links on the left to get to the section you want Section 1: Getting Started Section 2: Moving Banner Section.
Cascading Style Sheets Creating a Uniform Site. Style Sheets  Style sheets are used for conformity on a web page or web site.  Style sheets eliminate.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
Cascading Style Sheets CSS. Source W3Schools
DYNAMIC HTML What is Dynamic HTML: HTML code that allow you to change/ specify the style of your web pages. Example: specify style sheet, object model.
Introduction to CSS. What is CSS? CSS ("Cascading Style Sheets") determines how the elements in our XHTML documents are displayed and formatted. By using.
Are You Smarter Than a 5 th Grader? 1,000,000 5th Grade HTML 5th Grade Syntax 4th Grade HTML 4th Grade Syntax 3rd Grade HTML 3rd Grade Syntax 2nd Grade.
Cascading Style Sheets I Embedded Style Sheets. Page Design ICSS 2Instructor: Sean Griffin What is a Style Sheet? A style sheet is a text file that contains.
WEEK -1 ACM 262 ACM 262 Course Notes. HTML What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML.
External Style Sheets Exploring Computer Science – Lesson 3-6.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
How to… Cascading Style Sheets. How to Insert a Style Sheet When a browser reads a style sheet, it will format the document according to it. There are.
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
XP 2 HTML Tutorial 1: Developing a Basic Web Page.
XP 1 HTML Tutorial 1: Developing a Basic Web Page.
Creating Your 1 st Web Page. Tags Refers to anything between on a webpage Most appear in pairs surrounding content Some appear as empty tags (no closing.
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.
HTML5 and CSS3 Illustrated Unit C: Getting Started with CSS.
CSCE Chapter 3 (Cascading Style Sheets) CSCE General Applications Programming Benito Mendoza 1 By Benito Mendoza Department of Computer.
CSS DHS Web Design. Location Between the & Start with – End with –
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
Introduction To CSS. Lesson 1: History of CSS CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. There were.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 1 Using HTML to Create Web Pages.
Cascading Style Sheets Part 1 1 IT 130 – Internet and the Web.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Web Basics: HTML/CSS/JavaScript What are they?
CSS Classes.
>> Introduction to CSS
Cascading Style Sheets (CSS)
Cascading Style Sheets - Building a stylesheet
Introduction to CSS.
What are Cascading Stylesheets (CSS)?
What is HTML?.
Cascading Style Sheets - Building a stylesheet
CSS Classes.
Presentation transcript:

CSS Classes

What is a CSS Class? A CSS class provides us with a tool to create custom styles for elements on our web pages. Using classes can save us from typing the same formatting code for numerous elements. Classes enable us to make wide-scale styling changes very quickly. In our earlier examples of using CSS, we applied the same formatting to all instances of a particular element. A CSS class allows us to define different styles for the same element type. For example, we can make one paragraph appear in green text and another paragraph show in red text.

Syntax and Use of CSS Classes: <head> <style type="text/css"> .center { text-align:center; } </style> </head> Class definitions are placed along with all the other CSS inside the <head> section of the document. A CSS class is defined with a period, followed by the name of the class. <p>Paragraph 1</p> <p class="center">Paragraph 2</p> By adding the class="center" to this paragraph element, we are telling the browser to apply all formatting defined for that class to this particular paragraph. Paragraph 1 Paragraph 2

Syntax and Use of CSS Classes: <head> <style type="text/css"> .special { text-align:center; color:green; font-style:italic; } </style> </head> As before, multiple styles can be defined in a single statement. Remember the semicolon at the end of each line. <p class="special">Paragraph</p> Paragraph

Syntax and Use of CSS Classes: <head> <style type="text/css"> .center { text-align:center; } .green { color:green; .italic { font-style:italic; </style> </head> CSS classes can even be combined. The element will reflect the formatting definitions from all the classes being applied. <p class="center green italic">Paragraph</p> Paragraph

Syntax and Use of CSS Classes: <head> <style type="text/css"> .green { color:green; } </style> </head> <h1 class="green">Heading</h1> <p class="green">Paragraph</p> <ul> <li>List Item 1</li> <li class="green">List Item 2</li> </ul> Generic classes like these can be applied to any element we choose. Heading Paragraph List Item 1 List Item 2

Syntax and Use of CSS Classes: <head> <style type="text/css"> p.green { color:green; } </style> </head> You can also specify that only particular elements be affected by a class. In this example, we have defined the .green class to apply only to the paragraph element. <h1 class="green">Heading</h1> <p class="green">Paragraph</p> <ul> <li>List Item 1</li> <li class="green">List Item 2</li> </ul> If we try to apply the .green class to other elements, it will have no effect; the browser will simply ignore the class definition. Heading Paragraph List Item 1 List Item 2

The <span> element: <head> <style type="text/css"> .green { color:green; } </style> </head> The <span> tag allows us to apply class styling to a specific section within an element. Note that the <span> tag does nothing on its own. Only when we associate it with a class does it make a change to how the page displays. <p>This is a <span class="green"> typical</span> paragraph</p> This is a typical paragraph.

Naming CSS Classes: Give some thought to how you name your CSS classes. By using class names that describe how the element will look (.green, .center), we can make things confusing in the future. What if we later change our green text to be red? We would have the .green class display in red! A much better approach is to use class names that describe the meaning of the content, not how it will look: Problematic names .green .underline .center .bigletters Better names .slogan .booktitle .caption .headline