Intro to Web Design. ACM Webmonkeys @ UIUC



Similar documents
Contents. Downloading the Data Files Centering Page Elements... 6

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

Web Development. Owen Sacco. ICS2205/ICS2230 Web Intelligence

Coding HTML Tips, Tricks and Best Practices

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

HTML and CSS. Elliot Davies. April 10th,

This document will describe how you can create your own, fully responsive. drag and drop template to use in the creator.

KOMPOZER Web Design Software

Website Development Komodo Editor and HTML Intro

Caldes CM12: Content Management Software Introduction v1.9

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

Using Style Sheets for Consistency

{color:blue; font-size: 12px;}

Designing HTML s for Use in the Advanced Editor

Microsoft Expression Web Quickstart Guide

CHAPTER 10. When you complete this chapter, you will be able to:

The Essential Guide to HTML Design

Garfield Public Schools Fine & Practical Arts Curriculum Web Design

Joomla Article Advanced Topics: Table Layouts

ICE: HTML, CSS, and Validation

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

HTML TIPS FOR DESIGNING

We automatically generate the HTML for this as seen below. Provide the above components for the teaser.txt file.

Introduction to XHTML. 2010, Robert K. Moniot 1

GUIDE TO CODE KILLER RESPONSIVE S

EVENT PLANNING MYTHBUSTER. Building Pre-event Engagement: How to Make an Invite

The Essential Guide to HTML Design

Campaign Guidelines and Best Practices

Chapter 1: Outlook Isn t Going Anywhere Chapter 2: 17 Must-Know Tricks for Outlook 2007, 2010 &

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

Learning Web Design. Third Edition. A Beginner's Guide to (X)HTML, Style Sheets, and Web Graphics. Jennifer Niederst Robbins

JOOMLA 2.5 MANUAL WEBSITEDESIGN.CO.ZA

JJY s Joomla 1.5 Template Design Tutorial:

Creative Guidelines for s

Creating Web Pages with HTML Simplified. 3rd Edition

Advanced Drupal Features and Techniques

LaGuardia Community College Thomson Ave, Long Island City, New York Created by ISMD s Dept. Training Team. Overview

But have you ever wondered how to create your own website?

jquery Tutorial for Beginners: Nothing But the Goods

Creating a Resume Webpage with

Web Developer Jr - Newbie Course

WP Popup Magic User Guide

Creating HTML authored webpages using a text editor

Guidelines for Effective Creative

Module 6 Web Page Concept and Design: Getting a Web Page Up and Running

Web Design for Programmers. Brian Hogan NAPCS Slides and content 2008 Brian P. Hogan Do not reproduce in any form without permission

Joomla! 2.5.x Training Manual

CST 150 Web Design I CSS Review - In-Class Lab

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

How to Properly Compose HTML Code : 1

Drupal Training Guide

Web page design in 7 days!

FOUNDATION OF INFORMATION TECHNOLOGY Class-X (TERM II)

Site Maintenance. Table of Contents

Web layout guidelines for daughter sites of Scotland s Environment

Introduction to Web Design Curriculum Sample

How to Edit Your Website

Introduction to Web Development

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

New Perspectives on Creating Web Pages with HTML. Considerations for Text and Graphical Tables. A Graphical Table. Using Fixed-Width Fonts

So you want to create an a Friend action

ADOBE DREAMWEAVER CS3 TUTORIAL

Creating Web Pages with Dreamweaver CS 6 and CSS

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

Base template development guide

Informz for Mobile Devices: Making Your s PDA and Phone-Friendly

Using Adobe Dreamweaver CS4 (10.0)

By Glenn Fleishman. WebSpy. Form and function

Dreamweaver CS5. Module 1: Website Development

HTML Lesson 7. Your assignment:

PE Content and Methods Create a Website Portfolio using MS Word

Designing HTML ers

Creator Coding Guidelines Toolbox

Recreate your Newsletter Content and Layout within Informz (Workshop) Monica Capogna and Dan Reade. Exercise: Creating two types of Story Layouts

Style & Layout in the web: CSS and Bootstrap

Fairsail PDF Template Generator: A Complete Guide

Microsoft Word 1A: Business Letters: Format, Text Wrap, Insert Text Box, Logo

CiviCRM for The Giving Circle. Bulk Mailing Tips & Tricks

customer community Getting started Visual Editor Guide!

WYSIWYG Editor in Detail

CONTENTM WEBSITE MANAGEMENT SYSTEM. Getting Started Guide

User Guide for Smart Former Gold (v. 1.0) by IToris Inc. team

Web Portal User Guide. Version 6.0

RESPONSIVE DESIGN FOR MOBILE RENDERING

Sample Table. Columns. Column 1 Column 2 Column 3 Row 1 Cell 1 Cell 2 Cell 3 Row 2 Cell 4 Cell 5 Cell 6 Row 3 Cell 7 Cell 8 Cell 9.

NDSU Technology Learning & Media Center. Introduction to Google Sites

Responsive Web Design: Media Types/Media Queries/Fluid Images

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

MadCap Software. Import Guide. Flare 11

Basic tutorial for Dreamweaver CS5

Short notes on webpage programming languages

Google Sites: Creating, editing, and sharing a site

Excel Intermediate Session 2: Charts and Tables

Web Ambassador Training on the CMS

Sage Accountants Business Cloud EasyEditor Quick Start Guide

CIS 467/602-01: Data Visualization

Transcription:

Intro to Web Design ACM Webmonkeys @ UIUC

How do websites work? Note that a similar procedure is used to load images, etc.

What is HTML? An HTML file is just a plain text file. You can write all your HTML in Notepad or gedit Similar to.cpp,.tex,.java, etc HyperText Markup Language The word "markup" means it only indicates how the page should look and behave Unlike a programming language, does not contain explicit instructions for the browser "client-side" languages like Javascript, however, do Uses an XML-derived format

The key idea behind XML (and HTML) Content is organized into ELEMENTS -- essentially, a container Elements specify a part of the webpage, and can alter how their content is displayed For example: Sometimes you want bold text. Sometimes you want <b>bold</b> text. You should visit this page. You should visit <a href='http://www.example.com'>this page</a>.

More about elements Note that each element has a starting tag and a closing tag. Each tag is surrounded by angular braces (<>) Starting tags have the name of the tag, plus any attributes to qualify the tag list attributes one after the other, in the form x="y" z=" a" b="c d" Ending tags have a forward slash (/) before the tag name, and cannot have attributes. <tagname attr="value" something="else"> Content goes here. You can <nest>tags</nest>. </tagname>

Anatomy of an element the opening (or starting) tag attributes <element name attr="val" foo="bar"> contents </element> the closing tag

Commonly-used elements <b>text</b> Makes the contained text bold. <i>text</i> Italicizes the contained text. <u>text</u> Underlines the contained text. <a href="http://www.google.com">link Text</a> Turns the contents into a link to the URL specified in the "href" attribute. <img src="images/myimage.jpg"/> Inserts an image. The path can be a full URL, or a relative path (that is, relative to the HTML file). <br/> Inserts a line break.

General structure of a basic HTML page <html> (the container element that should wrap everything) <head> (this section is ONLY for information for the browser) <title>my Webpage</title> </head> <body> (this is where your actual content goes) </body> (this be dead man's land) </html>

So, let's make a website. On the next slide is a mock-up (i.e., a picture of what we want it to look like) of a website a client wants. Rather than list tags one by one, let's walk through the basics by seeing what we need to know in order to make this website Feel free to follow along by yourself: Open up Notepad, gedit, or whatever Create a new file and save it as example.html In Notepad, make sure you don't save it as example. html.txt instead Right click on the file (in Explorer or Nautilus) and open with Firefox (or Chrome) to view it.

Where to start? I recommend working from the top down. Browsers will render your HTML from the top down as well, so it makes sense. However, to make things a bit easier, first consider how everything will fit together. In this case, we want to structure the layout of the page There are multiple ways to do this, but let's start with the simplest and oldest: a table.

Tables In this context, "table" refers to the sorts of tables you see used to display statistics, poll results, etc. So why are we using it to structure the layout of our page? Because looked at in the right way, the page actually fits into a table well (provided we can merge some cells):

How to make a table For our table: First, we need to lay out the basic 2-col, 2-row structure. Then, we merge the top two cells to make the title bar. In HTML: First, use the <table> tag to wrap the entire table. Use the <tr> (table row) tag for each row. Within each row, use the <td> (table data) for each cell. So, we get:

Our code so far: <html> <head><title>example</title></head> <body> <table border="1"> (always a good idea to add a border when starting out.) <tr> <td>my </td> <td>blog.</td> </tr> <tr> <td>left bar</td> <td>main content</td> </tr> </table> </body> </html>

So what does that give us?

Uh... Not really what I had in mind. But, that's all we told the browser to do -- we need to be a little more specific. Let's start by making this table take up the whole page. Tables have the nice property of being able to specify their width and height easily in HTML. Let's use "100%" for both -- that will make the table use up 100% of its parent element's size (here, the body tag). <table width="100%" height="100%" border="1">

Resizing cells individually Before we try it out again, let's also make it so that each cell uses up the right amount of space. We want our top row to be exactly 95 pixels high, but we want the bottom row to use up the rest. This is much harder to do without tables -- if we were using a pure-css approach, we'd be doing things differently. But since we are using tables... Also, we want the left column to be 167px wide.

<html> <head><title>example</title></head> <body> <table width="100%" height="100%" border="1"> <tr> <td width="167px">my </td> <td height="95px">blog.</td> </tr> <tr> <td width="167px">left bar</td> <td>main content</td> </tr> </table> </body> </html>

Looking better. There are still three problems we want to fix with the layout before moving on. The space around the edge of the table... that'll be a problem. The client didn't want the blue title bar to have a margin around it. The content is vertically-centered in each cell... we don't want that, either. Easy: just add valign="top" to each cell. We also need to merge the top two cells. This one is easy, if a bit counter-intuitive: we remove the right cell, and add an attribute called colspan (column span) to the left cell with the value 2. That will make it act as if it were two whole cells.

Let there be CSS The first problem, however, is pretty specific, and we'll need more than just HTML to deal with it We can apply a style to the document The markup language that we define styles in is called CSS, for Cascading Style Sheets. For now, we'll throw the CSS right into the tags -- this is called "inline" CSS. Usually, you abstract the CSS into a separate style sheet. We put this style information inside the style attribute. Note: Some problems can be solved with either HTML attributes or CSS styles; some can only be solved via one or the other.

Adding some style to our page <body style="margin:0px;"> Note that the syntax used for specifying style attributes is somewhat like how HTML attributes work -- however, instead of property="value", we use property:value; (with semicolons separating multiple styles). The property we're adjusting here is called margin. Margin is how much extra space should be around the given element That is, how wide the element's "personal space" is. Here, we don't want any. Why did I put this in the body tag, rather than table? Experiment! Sometimes it's hard to tell what will work. Remember to test on multiple browsers...

Much better.

Still pretty bad, though. Let's make this actually look like something. We want the top cell to have a blue background, right? So let's give it a style that will make it blue. The background property (in CSS) is a versatile way to specify backgrounds. Look it up for more details. Here, we just want background:#006699; #006699 is a hexadecimal color code. It's a compact way of specifying colors. I would recommend using a hex colorpicker of some sort (google it, there are plenty) to get these. Remember the # in the beginning! You can use words for very common colors, like white, red, or black. E.g., background:white;

The header text Let's also make the text inside the blue bar look like it should. First, we'll wrap it in an h1 element (header-one). h1, h2, h3... h7 are various levels of header text. You should use them when appropriate (for accessibility). Then, we need to style that header element: Need to make it white color:white; Need to make it big font-size:43px; Need to make it Verdana font-family: Verdana; <h1 style="color:white;font-size:43px;fontfamily:verdana;">my Blog</h1>

<html> <head><title>example</title></head> <body style="margin:0px"> <table width="100%" height="100%" border="1"> <tr> <td height="97px" valign="bottom" colspan="2" style="background:#006699;"> <h1 style="color:white;font-size:43px; font-family:verdana;">my Blog</h1> </td> </tr> <tr> <td width="167px" valign="top">left bar</td> <td valign="top">main content</td> </tr> </table> </body> </html> (Notice how we can split tags across multiple lines? HTML doesn't really care.)

Better... but...

What's going on? Unfortunately, the header tags all come bundled with their own (pretty crappy) styles Lots of margin/padding and boldness You can use e.g. Firebug to find out more We'll need to overwrite these. style="margin:5px;padding:0px;font-weight:normal;... <h1 style="margin:5px;padding:0px;font-weight: normal;color:white;font-size:43px;font-family: Verdana;">My Blog</h1> (there's a good reason styles are put in separate CSS files!)

That fixes that, so let's move on. We need a border on the bottom of the header... Add style="border-bottom:7px solid white;" to the cell This gives the cell a solid (as opposed to dashed, for example) bottom border 7 pixels wide, colored white. Also, the page as a whole needs that light blue background. Add background:#dbe8fd; to the body tag's style. And, let's get rid of that border on the table. Don't need it right now.

Not bad. That takes care of the header bar. Now, we need to add the off-white boxes for the actual page content. We could nest another table inside each cell, and style the cell of that table like we did before... But there's no need. We can use HTML's all-purpose "content box" element, the DIV. <div style="">anything you want</div> Note that the DIV element has very few actual HTML attributes -- to really manipulate it, you need to use styles. And since all a DIV starts off as is an invisible box, you'll usually need to style it.

Making the content DIV So, we want a box that fills up each table cell, but still has some margin around it. We can use the margin style to add in the spacing around the box, but how do we make each box fill up the entire cell? This is actually a tricky problem, so we're just going to approximate a solution to save time. We'll tell the left box exactly how wide to be, and for the right one, tell it 95%. Why can't we just tell each box 100% and then add margin? Per the HTML standard, margin is added on top of width and height. So is padding from the containing element! There are lots of little things like this (some browserspecific) that can make web design frustrating.

So, the code for those DIVs... Left: <div style="width:140px;margin:8px;height:95% background:#edf3fe;"> Left bar </div> Right: <div style="width:95%;margin:8px;height:95% background:#edf3fe;"> Main content </div> And remember, these go inside the table cells -- that's where we want them to show up on the page, after all.

Looking better. One thing: the spacing between the two content areas is too wide. Why? The margin from both boxes is applied, meaning there's 16px worth of margin between them. We want to set the left-margin of the right box (or the rightmargin of the left box) to be zero pixels. To do this, we could either specify margins side-by-side, or override the margin-left property like so: style="margin:8px;margin-left:0px;" CSS has the property that later definitions will override previous ones. This comes in handy often.

Finishing things up The text inside the content boxes has two problems: Too close to the edge of the box. Times New Roman? Not so much. We can fix both problems by styling the DIVs. font-family:verdana;font-size:14px;padding:8px; Also, we want a header in the right box -- since the header there is of secondary importance to the main title, we use h2. <h2 style="font-size:31px;font-family:verdana;fontweight:normal;margin-top:0px;">post Title</h2>

A bit more... And, we want to put an image in the left bar. To do so, we use the img tag: <img src="myimage.jpg" alt="picture of me"/> Note that this tag self-closes. Some tags do this, if they cannot contain any content. Also, we want that image centered. It's deprecated, but to keep things simple, let's just use the <center></center> tag. <center>anything</center> will center that content. Finally, let's put a newline beneath it, to avoid cramping the text. The <br/> tag is another self-closing tag. It stands for "break", as in, line break.

<html> <head><title>example</title></head> <body style="margin:0px;background:#dbe8fd;"> <table width="100%" height="100%"> <tr> <td height="97px" valign="bottom" colspan="2" style="background:#006699;border-bottom:7px solid white;"> <h1 style="margin:5px;padding:0px;font-weight:normal;color:white;font-size:43px;fontfamily:verdana;">my Blog</h1> </td> </tr> <tr> <td width="167px" valign="top"> <div style="width:140px;margin:8px;background:#edf3fe;height:90%;font-family:verdana; font-size:12px;padding:8px;"> <center> <img src="myimage.jpg" alt="picture of me"/> </center> <br/> Left col. </div> </td> <td valign="top"> <div style="width:95%;margin:8px;margin-left:0px;background:#edf3fe;height:90%;fontfamily:verdana;font-size:14px;padding:8px;"> <h2 style="font-size:31px;font-family:verdana;font-weight:normal;margin-top:0px;" >Dolorem Ipsum</h2> Right col. </div> </td> </tr> </table> </body> </html>

Key ideas to take away Build your webpage step-by-step. It's easier to tackle one thing at a time than try to write out your entire page at once. There are hundreds of HTML tags and CSS properties. Find a good reference and bookmark it. For example, http://www.w3schools.com There are multiple ways to do anything in HTML/CSS. There may not be a "best" way for something, but there usually are better and worse ways. Google your problem (i.e. "fixed-height two column CSS layout") if you need to.

Can you modify the layout?