Course created by Sarah Phillips [email protected] BBCD Melbourne BAPDCOM Version...

24
CD202 Interface, Representation & Sequence Problem solving internet design issues Course created by Sarah Phillips [email protected] BBCD Melbourne BAPDCOM Version 1 – April 2013. http://bbcdcomdes.weebly.com/

Transcript of Course created by Sarah Phillips [email protected] BBCD Melbourne BAPDCOM Version...

Page 1: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CD202 Interface,

Representation & Sequence

Problem solving internet design issues

Course created by Sarah Phillips

[email protected]

BBCD Melbourne BAPDCOM Version 1 – April 2013.

http://bbcdcomdes.weebly.com/

Page 3: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

Intro to CSS

Page 4: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics

CSS stands for Cascading Style Sheets and controls the style and formatting of your content.

CSS can allow for different viewing on different platforms including mobile, text readers and what your page will look like when printed.

Page 5: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics

CSS Zen Gardenhttp://www.csszengarden.com/

Page 6: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

Intro to CSS

Embedding an external style sheet

<link rel=”stylesheet” type=”text/css” href=“styles.css” />

This goes in the HEAD section of your HTML file.

Page 7: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics

All CSS is written in the format:

selector { property: value }

Page 8: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics

When you nest one element inside another, the nested element will inherit the properties assigned to the containing element. Unless you modify the inner elements values independently.

A font declared in the body will be inherited by all text in the file no matter the containing element, unless you declare another font for a specific nested element.

Page 9: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS basics – The ID selector

The id Selector The id selector is used to specify a style

for a single, unique element. The id selector uses the id attribute of the

HTML element, and is defined with a "#”.

HTML: <div id=“wrapper”></div>CSS: #wrapper{

property:value;}

Page 10: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics – The Class selector

The class Selector The class selector is used to specify

a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements.

This allows you to set a particular style for any HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a "."

Page 11: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics – The Class selector

ExampleHTML: <div

class=“column”></div>CSS:

.column{property:value;

}

Page 12: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

When do you use each?

Use an ID selector for elements that only appear once per page (eg header, menu, footer etc)

Use a class selector for elements that will be used multiple times (eg. Paragraphs, columns etc)

Page 13: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

Common properties

color:#ffffff background:url(image.jpg) #ffffff; font-family:Verdana, Geneva, sans-serif; font-size:10px; margin-left:auto;

Commenting within CSS/* This is a comment */

You can find a more comprehensive list here: http://w3schools.com/css/css_reference.asp

Page 14: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS & DIV tags

DIV tagsYou can style a DIV tag and use CSS that affects all the content within it. For example

<div id=”container”> Site contents go here</div>

The CSS file contains this:#container{ width: 500px; margin-left: auto; margin-right:auto; padding: 20px; border: 1px solid #666; background: #000000;}

Page 15: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Basics

Spans Spans are very similar to divisions

except they are an inline element versus a block level element. No line break is created when a span is declared.

You can use the span tag to style certain areas of text, as shown in the following: <span class=”italic”>This text is italic</span>

Page 16: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS basics

Combining selectors:

h1, h2, h3, h4, h5, h6 {color: #009900;font-family: Georgia, sans-serif;

}

Page 17: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Exercise

Creating a horizontal navigation bar When creating a horizontal navigation bar,

best practice is to use an unordered HTML list, styled with CSS. Sounds ridiculous, but with a few css styles, it works.We need to style both the list itself (<ul>) and the list items (<li>) For example...

ul#navigation { float:left margin: 0; padding: 0; width: 100%; background-color: #039;

}

Page 18: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Exercise cont.

List items are normally block elements, but by switching the display from block to inline, you force the list elements to line up next to one another.

ul#navigation li { display: inline; }

The following code changes the link colour when you hover over.

ul#navigation li a {color:#333; } ul#navigation li a:hover { color: #999;}

Page 19: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

Floating vs absolute positioning

Absolute positioning allows you to set a position to the pixel.

Can use absolute positioning to make divs overlap. Eg http://www.bouliste.com.au/

Floats are used with dynamic content or flexible layouts.

Page 20: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

Floats

Source: http://css-tricks.com/all-about-floats/

Page 22: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

Google Fonts

http://www.google.com/fonts/

Google have a range of webfonts that are easy to use within your website. You can download the font to design with it in Photoshop and they also give you the code to stick into your HTML/CSS files to implement it.

Page 23: Course created by Sarah Phillips sphillips@lecturers.billyblue.edu.au BBCD Melbourne BAPDCOM Version 1 – April 2013.

CSS Exercise

Create a new HTML & CSS file and link them together.

In the HTML file, create a header div, a navigation div, 3 columns of content and a footer. (With dummy content please!)

In CSS, use floats to position all of your content.

Use a minimum of 10 CSS styles to style the look of your content.

Use a font from Google Fonts