CSc 337 Lecture 15: Review.

Slides:



Advertisements
Similar presentations
CSS Styling CSS Box Model & CS110: Computer Science and the Internet.
Advertisements

CSS Internet Engineering Spring 2014 Bahador Bakhshi CE & IT Department, Amirkabir University of Technology.
Cascading Style Sheets
Cascading Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Today CSS HTML A project.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Slide 1 CMPS 211 Internet Programming Spring 2008 Dynamic Effects with Styles Chapter 12 2/6/08.
Very quick intro HTML and CSS. Sample html A Web Title.
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.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
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.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
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,
กระบวนวิชา 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.
Creating a Web Page with Tables. Objectives Create a text table with preformatted text Create the basic structure of a graphical table Organize table.
XP Creating Web Pages with HTML Using Tables. XP Objectives Create a text table Create a table using the,, and tags Create table headers and captions.
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.
ITP 104.  While you can do things like this:  Better to use styles instead:
1 CSC 121 Computers and Scientific Thinking David Reed Creighton University HTML and Web Pages.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
 Word doc for you to download › Link at the beginning of class › 10 Questions › Answers to be added inline  Post to Sakai when completed › No resubmits.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Designing a Web Page with Tables. A text table: contains only text, evenly spaced on the Web page in rows and columns uses only standard word processing.
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
1 Lect 4 HTML-Intro. 2 HTML & Web Pages A Web page is a text document that contains additional formatting information in the HyperText Markup Language.
Stylizing a Navigational Menu Web Design Section 6-3 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Chapter 4 and 5. Objectives Introduce markup: elements and attributes How browsers interpret HTML documents Basic structure of HTML document What do style.
WebD Introduction to CSS By Manik Rastogi.
CSS.
HTML Basics.
The Box Model in CSS Web Design – Sec 4-8
4.01 Cascading Style Sheets
CSS Layouts: Positioning and Navbars
Semester - Review.
The Box Model in CSS Web Design – Sec 4-8
CSS Layouts: Grouping Elements
Unit 3 - Review.
Creating Page Layouts with CSS
The Box Model in CSS Web Design – Sec 4-8
Web Development & Design Foundations with HTML5 7th Edition
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
Web Development & Design Foundations with HTML5
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
Introduction to Web programming
IBM Kenexa BrassRing on Cloud Responsive Apply: Visual Branding Tool
The Internet 10/13/11 The Box Model
HTML Intro.
Fixed Positioning.
Web Programming A different world! Three main languages/tools No Java
Computers and Scientific Thinking David Reed, Creighton University
Web Development & Design Foundations with HTML5
Floating and Positioning
Introduction to HTML.
Web Development & Design Foundations with HTML5
Principles of Web Design 5th Edition
4.01 Cascading Style Sheets
CSc 337 Lecture 5: Grid layout.
Presentation transcript:

CSc 337 Lecture 15: Review

HTML and CSS Tracing Draw a picture of how the following HTML/CSS code will look when the browser renders it on-screen. Assume that the HTML is wrapped in a valid full page with a head and body. Indicate a non-white background by shading lightly or by drawing diagonal lines like . It is possible that some CSS rules shown will not apply to any elements. div { border: 2px solid black; padding: 1em; } body > div { margin: auto; width: 50%; } div #div, p { background-color: yellow; text-decoration: underline; } span div, span.div { border: 2px dashed black; } div > div.div { float: left; } #div, .span { clear: left; } span#span { background-color: yellow; } <div> <span>1</span> <div id="div">2 2</div> </div> <span class="div">3 3 3</span> <div class="div">4 4 4 4</div> <div id="span">5 5 5 5 5</div> <div class="span">6 6 6 6 6 6</div>

CSS Write the CSS code necessary to recreate the following appearance on-screen, exactly as shown. The page uses the same HTML code as in the previous problem. You are not allowed to modify the HTML. <div> <span>1</span> <div id="div">2 2</div> </div> <span class="div">3 3 3</span> <div class="div">4 4 4 4</div> <div id="span">5 5 5 5 5</div> <div class="span">6 6 6 6 6 6</div> All text now uses a monospace font at the default size. All borders shown are 2px thick and black in color. The element with "2 2" now has a yellow background. The elements with "3 3 3", "4 4 4 4", and "5 5 5 5 5" are now each exactly one fourth (1/4) of the page width. The element "2 2" now has bold text, and the element "5 5 5 5 5" now has italic text.

JavaScript / DOM Write the JavaScript code to add event behavior to the following web page. Assume that your code will be placed into a .js file that will be included in the page's header. The page contains an area with five images of baby Geneva, and a "Favorites" area. Your code should arrange it so that when one of these five images is clicked, that image will be moved to the rightmost end of the favorites area. Also, when an image is moved, a bullet is added to the end of the actions list indicating this. The bullet's text should be, "Moved [image] to favorites." where [image] is equal to the src attribute of the image moved. (As you'll see in the output on the next page, even though the HTML's src attribute for each image is only a file name such as geneva1.jpg, when you access this information in your code, it will be a full URL. This is expected.) Nothing should happen when the user clicks on any other content on the page, such as text or other images such as the pacifier. Assume that the user won't click on an image that is already in the Favorites. Move images by manipulating the order of elements in the DOM tree, not by manually setting x/y positions of elements. You may use Prototype's features if you like. You may not use innerHTML on this problem, nor change any HTML on the page; the only code you may add is JavaScript. The following is the complete HTML code for the body of the page:

JavaScript / DOM (continued) <h1> <img class="geneva" src="geneva_head.jpg" alt="Geneva" /> Geneva Pics! </h1> <div id="pics"> <img src="pacifier.jpg" alt="pacifier" /> <img class="geneva" src="geneva1.jpg" alt="Geneva" /> <img class="geneva" src="geneva2.jpg" alt="Geneva" /> <img class="geneva" src="geneva3.jpg" alt="Geneva" /> <img class="geneva" src="geneva4.jpg" alt="Geneva" /> <img class="geneva" src="geneva5.jpg" alt="Geneva" /> </div> <p>Click a picture to move it to the Favorites.</p> <fieldset id="favorites" class="geneva"> <legend>Favorite photos:</legend> </fieldset> <ul id="actions"></ul>

JavaScript / DOM (continued) The following is the page's initial appearance and appearance after clicking images #1 and #5:

JavaScript / DOM 2 Write the Javascript code to add behavior to the following HTML code. The page contains a text input box with id of foodname, and a drop-down list with an id of foodgroup. The user types a name of a food item into the foodname text box, such as apple or Cookie, selects a food group from the drop-down list, such as dairy or fruit, and then clicks the button with id of eat. When the eat button is clicked, any element on the page that matches all of the following criteria will be removed from the page: The element is an img element that has a class of food. The element's food group matches the group chosen in the foodgroup drop-down list. Food groups are represented as class attributes. This is in addition to the food class; recall that a class attribute can specify multiple classes separated by spaces. For example, a jug of milk would have the following element: <img src="milkjug.jpg" class="food dairy" alt="milk" /> The food item's name is the same as the text in the foodname box. The food's name is stored as the image's alt attribute. For example, if the user types cookie, img elements with an alt of cookie will be removed. Your code should be case-insensitive; for example, coOKIe should match images with an alt of cookie. The relevant HTML code for the page is the following. Your code should be general; it should not rely on the specific food images shown in the screenshot. You should also not rely on the exact ordering of the words in the class attribute.

JavaScript / DOM 2 (continued) <div> Name of Food: <input id="foodname" type="text" /> Food Group: <select id="foodgroup"> <option>dairy</option> <option>fats</option> <option>fruit</option> <option>meat</option> <option>veggies</option> </select> <button id="eat">Eat!</button> </div> <p> <img src="cookie.jpg" class="food fats" alt="cookie" /> <img src="apple.jpg" class="fruit yummy food" alt="apple" /> <img src="broc.jpg" class="food veggies" alt="broccoli" /> <img src="tomato.jpg" class="fruit food" alt="tomato" /> <img src="beefsteak.jpg" class="food meat" alt="steak" /> <img src="milkjug.jpg" class="food dairy" alt="milk" /> <img src="potatochips.jpg" class="fats food other" alt="chips" /> </p>

JavaScript / DOM 2 (continued)