CSS Exercises. Create a basic CSS layout Use BlueFish to open layout.html Create a layout using <div> tags Use a browser (Firefox) to view your page

Similar documents
Exercises. Task 1 Use My Computer to create a folder for the website. Step 1

Create a three column layout using CSS, divs and floating

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

Styles, Style Sheets, the Box Model and Liquid Layout

Taking Fireworks Template and Applying it to Dreamweaver

CSS worksheet. JMC 105 Drake University

What is the Box Model?

Using Dreamweaver CC. Logo. 4 Creating a Template. Page Heading. Page content in this area. About Us Gallery Ordering Contact Us Links

Using Dreamweaver CS6

ORB Education Quality Teaching Resources

How to lay out a web page with CSS

What do we mean by layouts?

When you complete this chapter, you will be able to:

Layout with Layers and CSS

How to lay out a web page with CSS

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

CS Multimedia and Communications. Lab 06: Webpage Tables and Image Links (Website Design part 3 of 3)

Getting Started with Eric Meyer's CSS Sculptor 1.0

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

ICT IGCSE Practical Revision Presentation Web Authoring

Web Design and Implementation

AGENDA :: MULTIMEDIA TOOLS :: (1382) :: CLASS NOTES

Tai-Jin Lee. Handout #5 11/01/2005. Navigation

Microsoft Expression Web Quickstart Guide

Positioning in CSS: There are 5 different ways we can set our position:

AGENDA :: MULTIMEDIA TOOLS :: CLASS NOTES

Designing the Home Page and Creating Additional Pages

ITSE 1401 Web Design Tools Lab Project 4 (Expression Web 4 - Units M, N, O, P) Last revised: 1/9/14

COMP 101 Spring 2017 EXAM 2 2 March 2017

ITNP43: HTML Lecture 5

The Importance of the CSS Box Model

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

c122jan2714.notebook January 27, 2014

Magazine-style websites often have lots of small items on a page. First you re going to create a heading and background for your magazine.

Chapter 1 Introduction to Dreamweaver CS3 1. About Dreamweaver CS3 Interface...4. Creating New Webpages...10

Web Design and Development ACS Chapter 12. Using Tables 11/23/2017 1

Introduction to CSS. 2 Sep 13. Derek Peacock. An introduction to defining CSS style rules using tags, classes and ids.

Cascading Style Sheets for layout II CS7026

FLOATING AND POSITIONING

E-Business Systems 1 INTE2047 Lab Exercises. Lab 5 Valid HTML, Home Page & Editor Tables

Produced by. Web Development. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) More on Relative Linking. Learning Objectives (2 of 2)

INTRODUCTION TO HTML5! CSS Styles!

Introduction to Dreamweaver CS3

HTML and CSS a further introduction

Page Layout Using Tables

Creating a Job Aid using HTML and CSS

How to lay out a web page with CSS

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

Introduction to WEB PROGRAMMING

Using Dreamweaver CS6

Client-Side Web Technologies. CSS Part II

Lab Introduction to Cascading Style Sheets

Guidelines for doing the short exercises

Using Dreamweaver. 4 Creating a Template. Logo. Page Heading. Home About Us Gallery Ordering Contact Us Links. Page content in this area

Building Page Layouts

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

Responsive web design (RWD) CSS3 Media queries. Mobile vs desktop web sites. Web Development 1 CS1115/CS5002

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

Before you begin, make sure you have the images for these exercises saved in the location where you intend to create the Nuklear Family Website.

Creating Layouts Using CSS. Lesson 9

Joomla! 2.5.x Training Manual

CSS (CASCADING STYLE SHEETS) LAYOUT: INTRODUCTION ON PAGE BACKGROUNDS. By Ted Mitchell

ICT IGCSE Practical Revision Presentation Web Authoring

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

CS193X: Web Programming Fundamentals

1.0 Overview For content management, Joomla divides into some basic components: the Article

Table Basics. The structure of an table

Stickers! Introduction. Step 1: Colourful coding sticker

Creating Editable Regions & WYSIWYG Styling

Downloads: Google Chrome Browser (Free) - Adobe Brackets (Free) -

CMPT 165: More CSS Basics

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

Produced by. Web Development. Eamonn de Leastar Department of Computing, Maths & Physics Waterford Institute of Technology

HTML/CSS Lesson Plans

Dreamweaver CS3 Lab 2

Getting Started with CSS Sculptor 3

Tutorial 4. Activities. Code o Editor: Expression Web o Focus : Base Layout, navigation with folders, external stylesheets, Open up Expression Web

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

To illustrate how to set TAG styles the <body> and <h1> tags (for the BODY and the HEADING 1 styles) will be adjusted.

Lab 2: Movie Review. overview.png background.png rottenbig.png rbg.png fresh.gif rotten.gif critic.gif

Appendix D CSS Properties and Values

CS7026 CSS3. CSS3 Graphics Effects

CSS Module in 2 Parts

CSS Box Model. Cascading Style Sheets

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

HIERARCHICAL ORGANIZATION

Using AJAX to Easily Integrate Rich Media Elements

CSS Cascading Style Sheets

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles

VISA/APCO/STAC 2P61 WEBSITE CREATION Fall Term 2012

Using Microsoft Word. Working With Objects

Cascading Style Sheets (CSS)

COMSC-031 Web Site Development- Part 2

Step 1 Download and Install KompoZer Step by step instructions to build your first web page using KompoZer web editor.

(Simple) JavaScript Framework Homework

Transcription:

CSS Exercises Exercise 1: Create a basic CSS layout Use BlueFish to open layout.html Create a layout using <div> tags Use a browser (Firefox) to view your page Task 1 Open layout.html in BlueFish a blank template page which has the head section and a map to a CSS page also created but blank. Enter three <div> tags in the empty body tags In each div tag put a paragraph text: one, two three: <div><p>one</p></div> <div><p>two</p></div> <div><p>three</p></div> Task 2 Let s get some basic CSS up and running now. In CSS page give the divs a yellow background not pretty but good for seeing what s what: In the same folder as layout.html, open styles.css Enter the following: Div { background-color: yellow; Task 3 Now let s set the body width first. Above the div rule, enter: body { width: 70%; margin-left: auto; marginright: auto;

Task 4 Now let s give these divs a proper width layout - We need to float our divs which means giving them individual classes in the html and then using CSS to position them In layout html, add a class to each opening div tag so your code looks like this: <div class="left"><p>one</p></div> <div class="middle"><p>two</p></div> <div class="right"><p>three</p></div> Now we can give them width and margins remember the box model rules! Now let s enter the CSS for each of these classes in styles.css. Remove the div rule and enter the following. Once you have entered the rule for.left you can copy and paste this twice and make the necessary small amendments from the code below to save time:.left { width: 30%; margin-right: 3%; float: left; background-color: yellow;.middle { width: 30%; margin-right: 3%; float: left; background-color: yellow;.right { width: 30%; float: right; background-color: yellow; Task 5 View your webpage! In the program interface, click on the browser view to open up Firefox and view your webpage.

Borders Looking good we have three nicely laid out columns but time to think about borders. Borders are problematic when doing layouts because they add to the overall space taken up by the row of columns so if you spend time making sure whichever measuring system you are using (percentage or pixels for example) takes up all the available space, adding a border will add further pixels to your layout causing the last column to start on a new row beneath the other two (Assuming we are working with three columns as in these exercises). Not a good outcome. We have two options: 1. Build in some give to our measurements so that the borders are accommodated. 2. Created a set of divs inside the original ones that exist purely to handle borders. This means that the borders will take up space within the predefined column not adding to the overall measurements. The second option is the easiest to manage in terms of laying out your page but it does clutter the html with another set of divs and of course another set of CSS rules for them. I think it is preferable though overall. Exercise 2: Add borders and a new row Add border div tags to the html Enter new content Use a browser (Firefox) to view your page Style the borders in the CSS Open layout.html in BlueFish Task 1 Add the following div tags within the current ones: <div class="border">... </div> the finished code will look like: <div class="left"><div class="border"><p>one</p></div></div> <div class="middle"><div class="border"><p>two</p></div></div> <div class="right"><div class="border"><p>three</p></div></div>

Task 2 In Styles.css enter some rules for the borders in a new class Under the existing rules enter:.border { border: thin; border-style: solid; bordercolor: black; Task 3 Let s tidy up the paragraph text with some css Task 4 Now let s add some more text to simulate a more realistic web content Under the existing rules enter: p { font-family: arial; margin: 3%; In the H drive open CSS Text.docx Copy para 1 into the first <p> tag where one currently is. Note the text to copy has the <p> tags too so you can replace the existing ones in your code Copy para 2 into the other <p> tags You will have columns with differing amounts of content. View your webpage! Task 5 In the program interface, click on the browser view to open up Firefox and view your webpage.

New rows When you want another row of columns you might think you simply have to cut and paste the divs you have already setup to repeat the layout on a new row. This is true but you must insert a break with a special CSS property in-between each row to ensure they start as separate rows. First try just pasting the existing div tags again and see what happens. If you have one column with more content than the others the result is unexpected and not desirable! The difference in column heights means that the new line of divs can t float to the left and be a new row. We need some way to make a distinct break between the divs. We use the <br> and give it a class of clear. Here it is in the html Exercise 3: Add a new row Copy and paste the existing layout View the result and problem Enter a rule to a line break to cure the problem Preview your work Task 1 Open layout.html in BlueFish Task 2 Try and fix the problem using a line break Copy the code in-between the <body> tags and paste it again underneath and check the result not what you might expect In-between the two copies, enter a line break: <br> Check the result it doesn't work! Task 3 Let s use some css to solve the problem. We give our <br> a class and then enter a rule in styles.css In the html give the <br> a class: <br class="clear"> And now under the rest of the rules in the CSS, enter: br.clear{ clear: both; Task 1 Enter a margin rule in the main <div> tags to add some space In the css, in each of the left, middle and right rules, add a line: margin-bottom: 2%; View your webpage! Task 2 In the program interface, click on the browser view to open up Firefox and view your webpage.

Exercise 4: Create a row of images Create the div tags for your images Insert images into the divs Create rules to manage the divs and images in CSS Task 1 Create 4 div tags with border divs inside Enter the following tags under the last paragraph of main text: <div><div></div></div> <div><div></div></div> <div><div></div></div> <div><div></div></div> Task 2 Create a class for outer divs and border class for inner divs Your code will look like this when finished: <div class="pic1"><div class="picborder ></div></div> <div class="pic2"><div class="picborder"></div></div> <div class="pic3"><div class="picborder"></div></div> <div class="pic4"><div class="picborder"></div></div> Insert 4 pics into divs Task 3 Insert four images into the inner div tags by entering: <img src="images/pic1.jpg" alt="test" id="pic1"> Change pic1.jpg to pic2.jpg pic4.jpg in each inner div tag so you map to the four different images in your images folder. Your code will look like this: <div class="pic1"><div class="picborder"><img src="images/pic1.jpg" alt="test" id="pic1"></div></div> <div class="pic2"><div class="picborder"><img src="images/pic2.jpg" alt="test" id="pic2"></div></div> <div class="pic3"><div class="picborder"><img src="images/pic3.jpg" alt="test" id="pic3"></div></div> <div class="pic4"><div class="picborder"><img src="images/pic4.jpg" alt="test" id="pic4"></div></div>

Task 4 Preview your work what a mess! We need some CSS to help us sort this out. Open styles.css and give rules for outer div classes float and percentages Give our image id s a width In styles.css enter the following code at the bottom to style the width of the outer divs the first three are identical so copy and paste and just change the class name: div.pic1 { width: 20%; float: left; margin-right: 6%; div.pic2 { width: 20%; float: left; margin-right: 6% div.pic3 { width: 20%; float: left; margin-right: 6% div.pic4 { width: 20%; float: right;

Add the following code for the image ID elements #pic1 { #pic2 { #pic3 { #pic4 { Task 5 Add a br.clear tag to end this section so further content starts reliably below Preview work Task 6 Give rules for border class Pics don t fit In index.html, add the following code under the divs we created for the images to end that section just above the <hr> tag: <br class="clear"> Check out the page getting better! Back in the CSS add the following code to style our border divs: div.picborder { border-color: red; border-style: solid; border-width: thin; border-radius: 15%; check results not quite there!

Task 7 Give pic ids a border radius Finish by giving the image id s a border radius to match and a minus margin-bottom setting to take care of the white space your image id rules will look like this when finished: #pic1 { margin-bottom: -3%; borderradius: 15% #pic2 { margin-bottom: -3%; borderradius: 15% #pic3 { margin-bottom: -3%; borderradius: 15% #pic4 { margin-bottom: -3%; borderradius: 15% Preview your work Task 8 Should be looking good!

Exercise 5: Create a two column layout for the main text Create two columns for main text area Float and space the columns Add a back ground gradient effect for the second column Task 1 Add div tags around the main text and underneath Give this divs the classes teaching and research Add <div> tags before and after the <p> tags that wrap the main text. Add <div></div> underneath the main text Add some content Copy the <p> tags and their content and paste it into the empty div tags you have just created. Check this in preview to make sure you have two lots of text in the browser. Task 2 Ad br clear after image and after research div close tag Add: <br class= clear > after the image StevePicForITLP.jpg and also after the <div class= research > closing tag (</div>). Task 3 Create some CSS for the div tags In styles.css, add the following code to style the new div tags: div.teaching { width: 55%; float: left; margin-right: 5%; div.research { width: 40%; float: right; Check your work you should have two columns

Task 4 Let s add a background gradient to the research div Add a border radius Go to http://www.css3factory.com/linear-gradients/ And using the tool create a gradient using two colours of your choice Copy the code and paste it into the bottom of your div.research CSS rule. Add this code to the class to give a small radius border: border-radius: 5%; Task 5 Preview your work Should be looking good!

Exercise 6: Create an text shadow effect for the H1 tag Edit the H1 style to include a text shadow effect that mimics engraving Experiment with different CSS styling Save and preview the index.html Add a rule to the H1 CSS Open the Styles.css file. Use the Save As to create a new file that matches a link from the navigation menu Enter the line of code as shown below in the H1 CSS entry: Text-shadow: 0px 1px 1px #D2FFFF; Step 2 Save the file and preview the index.html file in Firefox to see the effect. Exercise 7: Further ideas Go to publications.html and create a few more entries (or copy and paste existing ones!). Create <div> tags around each section with a class and make a gradient as a background. In biography.html create a multi column layout for the main section and pull some text from your department/college website to fill another column with supporting information for your biog. In the layout exercise experiment with different border styles and positioning using padding and margins.