EXTERNAL STYLESHEETS AND MORE HTML STYLING HTML and CSS part 2.

Slides:



Advertisements
Similar presentations
Intro to HTML. HTML HTML = HyperText Markup Language Used to define the content of a webpage HTML is made up of tags and attributes Content.
Advertisements

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.
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
CSS The basics { }. CSS Cascading Style Sheets - language used to – describe html appearance & formatting Style Sheet - file that describes – how html.
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Cascading Style Sheets
Today CSS HTML A project.
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.
Introduction to CSS.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
CSW131 Steven Battilana 1 CSW 131 – Chapter 5 (More) Advanced CSS Prepared by Prof. B. for use with Teach Yourself Visually Web Design by Ron Huddleston,
“Cascading Style Sheets” for styling WWW information DSC340 Mike Pangburn.
Lecture 5. CSS 2 What style will be used when there is more than one style specified for an HTML element? Generally speaking we can say that all the styles.
1 Getting Started with CSS. 2 CSS Cascading Style Sheets XHTML provides structure for our documents (web pages) CSS provides Style or Presentation for.
Web Workshop: CSS Objectives: - “What is CSS?” - Structure of CSS - How to use CSS in your webpage.
INTRO TO WEB DEVELOPMENT
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.
JMD2144 – Lesson 5 Web Design & New Media. ‘Div’ide and conquer One of the most versatile structure tags available is the.. tag Short for ision, it allows.
HTML & CSS A brief introduction. OUTLINE 1.What is HTML? 2.What is CSS? 3.How are they used together? 4.Troubleshooting/Common problems 5.More resources.
Cascading Style Sheets Part 1 Library and Information Services, University of St Andrews.
INFSCI  Start with a template base structure  Think about how to structure your document using headers, paragraphs, divs, unordered lists, imgs.
INFSCI  Last time we built a doggie web page in class following the instructions in the slide deck: Build Web Page with HTML – see week 3 The topics.
Eat Your Words! Creating webpage Layout. CONTENT The Layout of a Webpage HEADER FOOTER Each of these sections represents a ‘div’ (or divider). By linking.
Cascading Style Sheets. Defines the presentation of one or more web pages Similar to a template Can control the appearance of an entire web site giving.
.  Entertain  Inform  Educate  Blogs  Sell  Date  Gamble  Religion.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
Cascading Style Sheets Dave Edsall IAGenWeb County Coordinator’s Conference June 30, 2007.
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.
WRT235: Writing in Electronic Environments Basic CSS.
Essentials of HTML Class 4 Instructor: Jeanne Hart
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
Definition CSS “Short for Cascading Style Sheets, a new feature being added to HTML that gives both Web site developers and users more control over how.
IT Introduction to Website Development Welcome!
ECA225 Applied Interactive Programming Cascading Style Sheets, pt 1 ECA 225 Applied Online Programming.
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.
FUNDAMENTALS OF HTML, XHTML & CSS Lesson 4. THE OBJECTIVES -  In this lesson you will begin coding in HTML to provide the structure  You will learn.
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.
Quick Questions 1. What does HTML stand for? 2. What are the three main languages of the Web? 3. What is the purpose of the tags? 4. Why do we indent different.
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 8: Working with Style Sheets.
Introduction to CSS. What is CSS? CSS ("Cascading Style Sheets") determines how the elements in our XHTML documents are displayed and formatted. By using.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Spiderman ©Marvel Comics Creating Web Pages (part 1)
Understanding ID and Class in CSS Web Design – Sec 4-9 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
External Style Sheets Exploring Computer Science – Lesson 3-6.
IN THIS LESSON, WE WILL BECOME FAMILIAR WITH HTML AND BEGIN CREATING A WEB PAGE IN YOUR COMPUTER HTML – the foundation.
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
Practice for Chapter 3: Assume that you are a freelance web designer and need to create a website to promote your freelance company.
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.
IN THIS LESSON, WE WILL BECOME FAMILIAR WITH HTML AND BEGIN CREATING A WEB PAGE IN YOUR COMPUTER HTML – the foundation.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
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.
Introduction to CSS: Selectors
CSS: Cascading Style Sheets
Introduction to CSS.
Intro to CSS CS 1150 Fall 2016.
Introduction to CSS.
Intro to CSS CS 1150 Spring 2017.
Styles and the Box Model
Intro to CSS Mr. Singh.
IS 360 Understanding CSS Selectors
Training & Development
CSS Styles Introduction.
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
Web Programming and Design
One Set of Styles Connected to As Many Pages as You Want!!!
Presentation transcript:

EXTERNAL STYLESHEETS AND MORE HTML STYLING HTML and CSS part 2

Stylesheets – a better way to style HTML We’ve been working mainly with inline styling. The professional way to style is a linked stylesheet. Remember, in an HTML document, the head element holds instructions for the browser. Let’s go to your resume project folder. Inside, you should see index.html, which is your resume. In the folder, create sub-folders styles and images. In the styles folder, create a Notepad++ file called style.css and paste the resume CSS into it. All the code you need is under “resume project” at newamericanscode.com/curriculum.html

Getting ready Make sure you put your own personal information in the resume index.html Delete any unneeded code left over from my resume. What kinds of elements are in the page? Which ones are you unfamiliar with? Let’s talk about,,,, etc. Experiment with changing and moving these tags. What happens?

Class and id in CSS Class and id are the “hooks” CSS uses to target elements. Remember what we learned about classes: all objects (elements) that are members of a class, share the same properties of that class. All HTML elements of a class will have the same properties. Why might you want to do this? In the stylesheet, if you say “make all elements blue,” then all elements will be blue. Different types of elements can belong to the same class and an element can have more than one class. All, and elements, for example, can belong to the same class.

The id attribute The id attribute allows you to add or change properties of an element, even if its class says differently. An element can have only one id, and a particular id can only be used once on a page. Why might you want to do this? An element can belong to classes and have an id at the same time. If there is a conflict between the class and the id, the id wins. You will learn later that JavaScript can target and change elements by their type, class and id.

Where is the stylesheet? Notice how there are no inline stylings in the resume HTML page. All the styling is coming from an external stylesheet: styles.css. Stylesheets are in a separate folder, usually called style. The stylesheet gives elements properties and values according to their type, class and id.

Linking to a stylesheet You create a link to the stylesheet in the head element. Use the self-closing element with attributes of type, relationship and reference (path). The href attribute stands for hypertext reference – it tells the browser where to look for a file. The rel attribute tells the browser the relationship between the HTML document and the linked document: the linked CSS file is intended to style the HTML document. Type is not necessary but advisable for other reasons.

Is the stylesheet doing anything? The element in index.html says to your browser, “Follow this path, go to this location, open style.css and follow the styling instructions.” Open index.html in Chrome. Notice there is no styling in the resume – it is plain HTML. Check the element in index.html (it is a child of ) and see if you can find what is wrong. If the stylesheet is linked correctly, you will see colored boxes, etc. Is the path and names correct? What happened?

How the stylesheet “hooks” elements Now look at index.html in Notepad++ and notice elements,,,. These are the elements the stylesheet is hooking on to. In style.css, look for h, div, a, ul (in thin blue text). These are the same,, and in index.html. The difference is: in the style.css, these elements don’t have <> around them. In style.css, inside the curly brackets, notice the property and value, with a colon separating them – just like with inline style, as you might remember. We are giving each element a property and value, but doing it in the stylesheet. What are some of properties and values for the elements?

Styling classes in the stylesheet CSS grabs on to classes in the same way as elements. In index.html, look for class=“right” and class=“left”. What is the parent element of each? Now, go to style.css and look for right and left, in red text. Notice the period before each class name. This tells the browser we’re dealing with a class. Without a period, CSS would think you’re referring to elements called “left” and “right.” Inside the curly brackets, notice the property and value, with a colon separating them. Again, we are giving each member of that class a property and value – just how we did with elements. What are some of properties and values for the classes?

Styling ids in the stylesheet Look for the words footer, name and (in thick blue text) in the stylesheet. Notice the hashtag # before each name. This tells the browser that we’re dealing with an element id. Look at index.html in Notepad++ and notice which elements have ids assigned to them. In style.css, notice each id has properties and values with a colon separating them, just like with elements and classes. What are some of properties and values for the ids?

Descendent selectors (combinators) Notice how there’s a styling for.right class and also a.right p in the stylesheet. This allows us to target certain child elements for different styling. We’re saying, “All elements belonging to the.right class will have this styling, but for paragraph elements inside a.right element, apply these other styles.” This only targets elements inside.right class elements. If a element is inside an element with a different class, then.right p won’t affect it.

Keep working We will work more on your resume assignment. The goal will be to get your resume in final form. With your permission, I would like to publish it to newamericanscode.com under the student portfolio section. This is where we show the work students are doing. Use Google a lot – if you don’t know what a certain element or property is, Google like: HTML CSS div. Professional developers do this all the time. Also go back to the HTML exercises on freecodecamp.org. I will be here to help.

Have some fun Experiment with different properties and values. Do things with color especially. Google hexidecimal colors and look at some sites. Instead of just using simple color values, you can use thousands of different colors with hex values. Learn about the shadow property and how to apply it to text and divs. Learn about the border-radius property and apply it to. Learn about the hover property. When you mouse