HTML and CSS a further introduction

Similar documents
Styles, Style Sheets, the Box Model and Liquid Layout

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

Web Design and Implementation

What do we mean by layouts?

CSS worksheet. JMC 105 Drake University

ORB Education Quality Teaching Resources


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

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

CS7026 CSS3. CSS3 Graphics Effects

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

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

Using CSS for page layout

Building Page Layouts

Cascading Style Sheets for layout II CS7026

Adding CSS to your HTML

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

Getting Started with CSS Sculptor 3

The default style for an unordered (bulleted) list is the bullet, or dot. You can change the style to either a square or a circle as follows:

Guidelines for doing the short exercises

Programmazione Web a.a. 2017/2018 HTML5

Creating a CSS driven menu system Part 1

Getting Started with Eric Meyer's CSS Sculptor 1.0

Website Development with HTML5, CSS and Bootstrap

Designing the Home Page and Creating Additional Pages

READSPEAKER ENTERPRISE HIGHLIGHTING 2.5

Parashar Technologies HTML Lecture Notes-4

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.

TAG STYLE SELECTORS. div Think of this as a box that contains things, such as text or images. It can also just be a

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

Introduction to WEB PROGRAMMING

Table Basics. The structure of an table

COMSC-031 Web Site Development- Part 2

BIM222 Internet Programming

Taking Fireworks Template and Applying it to Dreamweaver

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

CSS for Page Layout Robert K. Moniot 1

Lab 1: Introducing HTML5 and CSS3

CMPT 165: More CSS Basics

CSS means Cascading Style Sheets. It is used to style HTML documents.

Introduction to HTML & CSS. Instructor: Beck Johnson Week 5

CS7026 Media Queries II. Different Screen Size Different Design

Reading 2.2 Cascading Style Sheets

CSS.

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

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

Using Dreamweaver CS6

Tutorial 2 Editor Brackets

Block & Inline Elements

WEBSITE PROJECT 2 PURPOSE: INSTRUCTIONS: REQUIREMENTS:

Create a three column layout using CSS, divs and floating

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

The Importance of the CSS Box Model

INFS 2150 Introduction to Web Development

INFS 2150 Introduction to Web Development

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

CE419 Web Programming. Session 3: HTML (contd.), CSS

In this project, you ll learn how to create a webpage for your favourite recipe.

Cascading Style Sheets Level 2

HTML Organizing Page Content

Tutorial 4: Creating Special Effects with CSS

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

COMS 359: Interactive Media

Assignments (4) Assessment as per Schedule (2)

First Diploma Unit 10 Client Side Web. Week 4 -The CSS Box model

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Deccansoft Software Services

Using Dreamweaver CS6

CSS Selectors. element selectors. .class selectors. #id selectors

Stickers! Introduction. Step 1: Colourful coding sticker

Interactive Tourist Map

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

APPLIED COMPUTING 1P01 Fluency with Technology

CSS: formatting webpages

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

Class 3 Page 1. Using DW tools to learn CSS. Intro to Web Design using Dreamweaver (VBUS 010) Instructor: Robert Lee

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

How to lay out a web page with CSS

USER GUIDE MADCAP FLARE Tables

Microsoft Expression Web Quickstart Guide

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

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

Introduction to Computer Science Web Development

More CSS goodness with CSS3. Webpage Design

Gdes2000 Graphic Design and the Internet

CSS THE M\SS1NG MANUAL. David Sawyer McFarland. POGUE PRESS" O'REILLr Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

2005 WebGUI Users Conference

THE HITCHHIKERS GUIDE TO HTML

Page Layout Using Tables

Web Designer s Reference

Layout with Layers and CSS

TUTORIAL MADCAP FLARE Tripane and PDF

Teach Yourself HTML5 & CSS 3: Week 3 Task 11 - Anchors Part 1

Zen Garden. CSS Zen Garden

Introduction to Dreamweaver CS3

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

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

CSS. Shan-Hung Wu CS, NTHU

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

Transcription:

HTML and CSS a further introduction By now you should be familiar with HTML and CSS and what they are, HTML dictates the structure of a page, CSS dictates how it looks. This tutorial will teach you a few little tips and tricks regarding the HTML5 tags and css3 that can make your life a little easier or make it a little prettier. Starting with a base outline as shown below A nice simple outline, specifying the doctype, a title in the head, a body with a div inside to form the whole body, this lets us better specify changes to the whole body. You ll see I ve created a header, div that we can use for our content and footer inside that to give a traditional site. Nav Bar Nav Bar first, we need to add a few things to the HTML to define the nav bar first. We ll use a HTML list, pretty standard for building sites, but we ll nestle it into a <Nav> tag. Thus the header now looks like this;

If you view your site now you ll find that it just gives you a list of links, we can fix that with a bit of CSS. Create a new CSS document called democss.css copy down the below; The first, for everything in between the nav wrapper we tell it to be displayed in a block display (like a <p>) and give a margin around the nav elements. Now, for the unordered list elements in the nav wrapper, we wipe the list style making it plain and set the font size. Now, for the list elements (li) in the nav wrapper to be displayed inline. Underneath, we continue the CSS, the first section here changes the links within the Nav unordered list elements to display in blocks, floating to the left, with some padding around it setting a blue colour for the font and in bold. For our last one we add a hover effect over the links, when we hover over, we change the background colour and font colour JUST of that list element. The next two links referencing webkit and moz are to deal with browser differences and how they render, adding some padding around the cells, reducing the margin. There s no better way to discover what works than to experiment and use things like firebug to discover what does and doesn t work. To get this to work you ll need to add a line in your html code to link it in, something like the below in between the head elements; Sections Sections help us have different styles for different areas of the page, we have to add a bit more HTML to section up the page and then a bit more CSS to style it. We ll add all our CSS to the existing document, but first, into our main div we ll add some sections then add a few tweaks. Let s do that first;

We change the div between our header and footer elements to add an id of main this is going to be our main body after all and a class of clearfix (more on that later). After that you can clearly see our sections, left and right with their ID s and content between them. Now for our CSS, we style our main body first, then we ll deal with that clearfix. So, with the div s of ID main, we display them in blocks and clear both sides. This means we stop any floating elements either side. Look here for more information. Finally we add a 20 pixel bottom margin. Now, we set up our two sections, the left one of 550 pixel width, the right with 300 pixel, both floating left (relative to their position). There is a big debate about fixed width versus relative or liquid layouts, for instance if you used a fixed pixel width then viewed it on a smaller pixel density screen it can be too big. However, liquid layout is generally being replaced with responsive design. Following on from setting up the two sections, we then add the clearfix code. This code stops things from overlapping other divs and causing problems as bits try to move and overflow. Ordinarily you d have to use things like clear, empty containers that sit between two floated sections, with this, we don t have to do anything of the sort. Below is an image from stack overflow that may help.

So, now you ve got a website layout setup, I ve used a lorem ipsum generator to flesh it out a bit more. It makes the division a bit clearer. You can see the example below. Styling it up This section is about styling it up, we ve got a reasonable page layout now and, like the nav bar we can style the boxes. I ll go through a few different ways of styling pages, using just CSS and HTML5. Rounded Borders This is quite simple, the new spec allows you to implement rounded borders, you can add it to any element. In the example below I ve just added it to the left hand box, but could easily add it to the right. This is the section CSS code for the left, you can see the code on top that we added before, this time we re going to add the bottom half. The first line sets the border to be a curved one, the second line sets a background to lime green and the third gives some padding around it.

CSS Tooltips CSS tooltips were a new one on me, they re a very straightforward but effective way of providing more information. I ve started by adding a link to the footer. It s just a <p> with some text in, followed by an anchor link of class tooltip that has some text and a span inside. The space is the bit that will go inside the tooltip with some CSS. At the moment though, it looks terrible, it s just a big link, time to add some CSS. The first bit is for styling the bit you hover over, it just makes it stand out a bit more giving it a plain view but ensuring that it has a dotted underline rather than solid. It also uses the cursor code to change the cursor. The second bit is for styling the actual tooltip, ensuring that the span bit is pushed off the page, hiding the tooltip text. Now you ll see that the tooltip bit has gone but the text is still there and if you hover over it nothing will happen. Time to add some more css to make it appear. This is for what happens when you hover over the tooltip and applies to the span, the text that goes into the tooltip. We set the font family, the positioning is absolute and we make sure it s always on top by changing the z index. Finally we update the background colour, for your site you may want to change the colour, just look up a hex code online. Now, when you hover over the tooltip you can see something appear, we can style it however we want. The basic example is shown below (I ve changed the background colour to make it more evident).

Text shadow Text shadow is a simple, easy to use effect to finish off your site. You can see the effect in the picture above, as long as it s subtle and not overused it s a nice way to accentuate. The CSS is simple, shown above, the only strange thing might be the RBGA bit, the first 0 is the horizontal offset of the shadow, the second (in this case 3px) is the vertical offset, the third 0 is how much it is blurred and the fourth the RGBA is the colour. RGBA is a notation that takes four values, the amount of Red, the amount of Green, the amount of Blue and the alpha (or transparency). You can use a standard RGB generator or colour picker and play around with the alpha value. Conclusion This tutorial now gives you a look at creating and adding little HTML5 and CSS3 to improve your website fairly easily. It adds a few little effects but most of the difference is making it easier for you, sometimes that s all it takes. Use the tricks along with some of the websites and tools detailed in order to improve your website looks. It s up to you to add to and improve your work.

http://css3clickchart.com/#box-sizing https://www.smashingmagazine.com/2009/07/css-3-cheat-sheet-pdf/ http://www.color-hex.com/color/897f7f