Introduction to Styling

Slides:



Advertisements
Similar presentations
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
Advertisements

CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Cascading Style Sheets
Cascading Style Sheets
Today CSS HTML A project.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
Introduction to CSS.
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.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
1 Dreamweaver CS5 intermediate class by Cookie Setton Build a CSS website WITHOUT TABLES Just when you thought you were starting to understand HTML coding,
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา 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.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
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.
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.
 Missing (or duplicate) semicolons can make the browser completely ignore the style rule.  You may add extra spaces between the properties/values to.
Dreamweaver MX. 2 Creating External Style Sheets-1 (p. 400) n A style is a group of formatting attributes identified by a single name. n An ________ style.
Chapter 3 Working with Text and Cascading Style Sheets.
Using Styles and Style Sheets for Design
Today’s objectives  Review  CSS | Rules | Declarations  HTML Structure document  Class asignment.
XP Dreamweaver 8.0 Tutorial 3 1 Adding Text and Formatting Text with CSS Styles.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CO1552 – Web Application Development 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.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
Introducing Cascading Style Sheets. Cascading Style Sheet Basics  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Tutorial 3 Adding and Formatting Text with CSS Styles.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
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.
CASCADING STYLE SHEET CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem.
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.
1 Cascading Style Sheets
WebD Introduction to CSS By Manik Rastogi.
CSS.
Cascading Style Sheets
Cascading Style Sheet.
Create a new stylesheet called Hotel Style
4.01 Cascading Style Sheets
Semester - Review.
Unit 3 - Review.
>> Introduction to CSS
Introduction to CSS.
Cascading Style Sheets
Madam Hazwani binti Rahmat
>> CSS Rules Selection
Cascading Style Sheets
Introduction to Web programming
Cascading Style Sheets (Layout)
Intro to CSS CS 1150 Fall 2016.
Cascading Style Sheets
CASCADING STYLE SHEET CSS.
COMP 101 Review.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Introduction to CSS.
Intro to CSS CS 1150 Spring 2017.
Introduction to Cascading Style Sheets (CSS)
Working with Cascading Style Sheets (CSS)
Working with Cascading Style Sheets (CSS)
Cascading Style Sheets
Using Cascading Style Sheets (CSS)
Web Design and Development
Part 1: Cascading Style Sheets
Introduction to CSS.
4.01 Cascading Style Sheets
Web Client Side Technologies Raneem Qaddoura
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

Introduction to Styling Introduction to CSS 26-Jun-19 Introduction to Styling By Derek Peacock An introduction to defining CSS style rules using tags, classes and ids. Derek Peacock

Separation of Concerns Introduction to CSS 26-Jun-19 Separation of Concerns The HTML file contains the raw content of a web page, and the css style sheet should control all the design and look of a web page. The two parts of a web page should be kept as separate as possible, so that designers can alter the look of a page without affecting its content. Other people can supply and alter the content without affecting the look of the page. Derek Peacock

A CSS Rule Introduction to CSS 26-Jun-19 A CSS rule consists of a selector which is used to define which parts of the page will be affected. The rule itself consists of a one or more properties each of which has specfiic values, such as foreground font colour being set to red for all. Derek Peacock

Applying Styles Directly in the html tag (Inline Styles) To the whole html page (Internal Styles)

External Styles (css) Introduction to CSS 26-Jun-19 Best practice is to ensure that an HTML page contains no style information at all. If it does it can not be changed easily by making a change in a single place in a style sheet, and seeing that change ripple through hundreds of web pages instantly. The only exception would be applying bold (as <strong>) and italics as <em> to specific pieces of text. Derek Peacock

CSS Selectors HTML Tags Class Names ID Names Rules Selector body { Introduction to CSS 26-Jun-19 CSS Selectors HTML Tags Class Names ID Names Rules Selector body { background-color: #EEFFD1; font-family: Times, “Times New Roman”, Serif; font-size: 1.0em; } Using HTML tags to define new css rules is the most important as they affect all pages in the web site. Only apply styling to an HTML tag that is likely to apply to most of the pages in the site. For example most pages should have the same outer background colour and the same font and font size for the most of the paragraph text. In this case a style has been applied to the body of the page, as the body contains everything on the page, then this style applies to all the page Derek Peacock

Design View Editing CSS Rules Introduction to CSS 26-Jun-19 Design View Editing CSS Rules Derek Peacock

Background Styles Introduction to CSS 26-Jun-19 Backgrounds can either be solid colour or can be an image which is displayed whole or repeated to form a pattern. Whenever an image is used it is better to have a background colour as well in case the image fails to load. Derek Peacock

Block Introduction to CSS 26-Jun-19 Block styles are most often used to align text, or to change the display mode from block to inline Derek Peacock

Box Introduction to CSS 26-Jun-19 Box is one of the most widely used categories as it is used to add padding inside a box element such as section, as well as adding margin outside the element. Padding and margin can be individually set for top, left, right and bottom by un-ticking same for all. The size of the box and whether the element floats or not can also be set here. Derek Peacock

Using a Class Selector Classes can be applied to any HTML tag. Introduction to CSS 26-Jun-19 Using a Class Selector Classes can be applied to any HTML tag. The same class can be used many times in one page. .container { width:960px; margin: auto auto; background-color: #EEFFD1; } The container has been set to be 960px wide, with a set background colour and margins which are automatically calculated. The end result is that the container will be cantered in whatever element it is inside of (usually the body) The dot before the selector name indicates that this selector is a class selector and not an HTML tag selector. However this is not a good example of defining a class. Why?? Derek Peacock

Using a Class in HTML <!DOCTYPE HTML> <html> <head> Introduction to CSS 26-Jun-19 Using a Class in HTML <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Page Title</title> </head> <body> <div class=“container”> </div> </body> </html> The class can be used on any HTML tag, in this case the <div> tag. As there is usually only the one container for a page, container would be better defined as an id based selector (see next page). Note the class name in HTML has no dot preceding the name Derek Peacock

Defining an ID Selector Introduction to CSS 26-Jun-19 Defining an ID Selector #container { width:960px; margin: auto auto; background-color: #EEFFD1; } ID selectors are unique names and the are identified in CSS by starting with a # symbol. An HTML page can only have one instance of that id. Derek Peacock

Using an ID Selector <!DOCTYPE HTML> <html> <head> Introduction to CSS 26-Jun-19 Using an ID Selector <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Page Title</title> </head> <body> <div id=“container”> </div> </body> </html> ID selectors are used in an HTML page by giving the tag an id attribute as shown above. Only one can be used per html page. Again the # symbol preceding the name is only used in css not html Derek Peacock

Linking External Style Sheets Introduction to CSS 26-Jun-19 Linking External Style Sheets <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>Page Title</title> <link rel="stylesheet" type="text/css" href="css/myStyles.css"> </head> <body> <div id=“container”> </div> </body> </html> The best practice is to store all the css rules in an external css file, and then attach that style sheet to whichever pages need it. This can be done from the CSS Styles panel on the right hand side of Dreamweaver, or in code view by dragging the file from the files panel into the code at the correct place. The correct place is in the <head> of the html page. Derek Peacock

Linking Style Sheets Code View: Drag the file into the <head> Introduction to CSS 26-Jun-19 Linking Style Sheets Code View: Drag the file into the <head> Design View Edit: Properties->href.. The easiest way to attach or link a style sheet is to click on the Attach Style Sheet icon in the CSS Styles panel. The style sheet can then be found using browse. The style sheet should be in a separate folder called css, styles, or stylesheets inside the web site. Derek Peacock

Grouping Styles h1, h2, h3, h4, h5, h6 { Introduction to CSS 26-Jun-19 Grouping Styles h1, h2, h3, h4, h5, h6 { font-family: Verdana, Arial, Helvetica; } h1 font-size: 2em; h2 font-size: 1.6em; Styles can be defined for multiple selectors. So for example defining a font that will be used for all the headings is shown above, that is then followed by specific sizes for each heading alone. Derek Peacock

Styling Links: Pseudo Classes Introduction to CSS 26-Jun-19 Styling Links: Pseudo Classes a { padding: 5px; } a:link { color: blue; } a:visited { color: purple; } a:hover {background-color: grey; } In some cases such as the <a> hyperlink tag, the tag name can be followed by a pseudo class name such as hover, to indicate the style to be applied when the mouse is hovering over the element. Derek Peacock

Defining Style Context Introduction to CSS 26-Jun-19 Defining Style Context Style all the paragraphs p { color: blue; } Style all the paragraphs in a section section p { color:red;} Style all the paragraphs in an article article p { color: green;} Style all the links in ordered lists items ol li a {…} Paragraphs for example can have different styles when they are inside sections, or articles. The order the rules are applied is important. The last applied has priority What colour will paragraphs be inside and article inside a section?? Derek Peacock

Colour Palettes Export Selecting an appropriate set of colours for a web sight is quite difficult. The choice depends upon the intended mood. The web sites above offer a way of selecting a set of colours which complement each other based around a selected main colour. There is a choice of scheme type, depending on how many different colours you want to use in your site, and the overall effect. The chosen scheme can be exported as an html + css page for future reference. Color Scheme Designer: 6 schemes with control on saturation and brightness Color Combination: 7 schemes with control on saturation and brightness

Introduction to CSS 26-Jun-19 Exported Scheme Derek Peacock

Light Page: Example Introduction to CSS 26-Jun-19 To get some idea what the chosen scheme might look like there is a preview facility where a Light Page or a Dark Page can be viewed as shown above. Derek Peacock