Web Design With Css

  • Uploaded by: AImhee Martinez
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Web Design With Css as PDF for free.

More details

  • Words: 1,860
  • Pages: 32
By:

AMELITA M. SANTOS (Faculty, School of Computer Science, Arellano University)

What is the web? In a nutshell, the web is a whole bunch on

interconnected computers talking to one another.  The computers (on the web) are typically connected by phone lines, digital satellite signals, cables, and other types of data-transfer mechanisms.  A 'data-transfer mechanism' is a nerd's way of saying: a way to move information from point A to point B to point C and so on. The computers that make up the web can be connected all the time (24/7), or they can be connected only periodically.  The computers that are connected all the time are typically called a 'server'.  Servers are computers just like the one you're using now to read this article, with one major difference, they have a special software installed called 'server' software.

Web Design The skill of designing hypertext presentations of content that is delivered to an end-user through the World Wide Web. The process of designing Web pages, Web sites, Web applications or multimedia for the Web and may utilize multiple disciplines, such as animation, authoring, graphic design, human-computer interaction, interaction design, photography, and search engine.

Technologies Involved  Markup languages (such as HTML, XHTML and

XML)  Style sheet languages (such as CSS and XSL)  Client-side scripting (such as JavaScript and VBScript)  Server-side scripting (such as PHP and ASP)  Database technologies (such as MySQL)  Multimedia technologies (such as Flash and Silverlight)

 A style sheet language is a computer language used to describe the presentation of structured documents. • A structured document is a document whose

sections are clearly defined and categorized (also called "well-formed"). A program presenting the document can present it in different styles because the content has been categorized.

 One modern style sheet language with widespread use is CSS (Cascading Style Sheets) , which is used to style documents written in HTML, or XHTML and other markup languages.

What is CSS??? CSS is the acronym for: ‘Cascading Style Sheets’ CSS is an extension to basic HTML that allows you to style your web pages. Style sheets let you place things exactly where you want them to be on the page, using the distance in pixels from the top and the left of the browser window.  Styles define how to display HTML elements  Styles are normally stored in Style Sheets  External Style Sheets can save you a lot of work  External Style Sheets are stored in CSS files  Multiple style definitions will cascade into one

Advantages of CSS CSS is an excellent addition to plain HTML.  With plain HTML you define the colors and sizes of text and tables throughout your pages. If you want to change a certain element you will therefore have to work your way through the document and change it.

With CSS you define the colors and sizes in "styles". styles As you write your documents you refer to the styles. Thus, if you change a certain style it will change the look of your entire site. CSS offers much more detailed attributes than plain HTML for defining the look and feel of your site. Finally, CSS can be written so the user will only need to download it once - in the external style sheet document. When surfing the rest of your site the CSS will be cached on the users computer, and therefore speed up the loading time.

Things to Remember About CSS: CSS code is simply written instructions that tells Web

browsers (like FireFox and Internet Explorer) how to display things on a page. For example:  make text bold.  position things a page.  set the font style for a page or paragraph etc.

The sister language to CSS is HTML: code that tells

the Web browser WHAT is actually in the page.

HTML file

A sample HTML

A simple HTML structure

This is header 1

This is header 2

This is a paragraph



Using Style  Styles are set by adding the TAG:

<STYLE ...>  This

is placed in the section of your page.

CSS Syntax The CSS syntax is made up of three parts: 1. a selector selector {property: value}  The selector is normally the HTML element/tag you

wish to define, the property is the attribute you wish to change, and each property can take a value.

2. a property and a value:  The property and value are separated by a colon,

and surrounded by curly braces:

body {color: black}

CSS Syntax  Note: If the value is multiple words, put quotes around the

value: p {font-family: "sans serif"}  Note: If you wish to specify more than one property, you must separate each property with a semicolon. The example below shows how to define a center aligned paragraph, with a red text color: p {text-align:center;color:red}  Note: To make the style definitions more readable, you can describe one property on each line, like this: p { text-align: center; color: black; font-family: arial }

Grouping You can group selectors by separating each

selector with a comma. In the example below we have grouped all the header elements. All odd header elements will be displayed in green

text color: h1,h3,h5 { color: green } All even header elements will be displayed in green text color: h2,h4,h6 { color: yellow}

The class Selector With the class selector you can define different styles for the same type of HTML element. Say that you would like to have two types of paragraphs in your document: one right-aligned paragraph, and one centeraligned paragraph. Here is how you can do it with styles: p.right {text-align: right} p.center {text-align: center} You have to use the class attribute in your HTML document:

This paragraph will be rightaligned.

This paragraph will be center-aligned.



CSS Syntax Note: To apply more than one class per given

element, the syntax is:

This is a paragraph.

The paragraph above will be styled by the class "center" AND the class "bold". You can also omit the tag name in the selector to

define a style that will be used by all HTML elements that have a certain class. In the example below, all HTML elements with class="center" will be centeraligned: .center {text-align: center}

CSS Style In the code below both the h1 element and the p

element have class="center". This means that both elements will follow the rules in the ".center" selector:

This heading will be center-aligned

This paragraph will also be center-aligned.



Add Styles to Elements with Particular Attributes You can also apply styles to HTML elements

with particular attributes. The style rule below will match all input elements that have a type attribute with a value of "text":

input[type="text"] {backgroundcolor: blue}

The ID Selector You can also define styles for HTML elements

with the id selector. The id selector is defined as a #. The style rule below will match the element that has an id attribute with a value of "green": #green {color: green}

The style rule below will match the p element

that has an id with a value of "para1":

p#para1 { text-align: center; color: red }

How to Insert a Style Sheet When a browser reads a style sheet, it will

format the document according to it. There are three ways of inserting a style sheet:

1. External Style Sheet  An external style sheet is ideal when the style is applied to

many pages. With an external style sheet, you can change the look of an entire Web site by changing one file.

2. Internal Style Sheet  An internal style sheet should be used when a single document

has a unique style. You define internal styles in the head section by using the <style> tag.

3. Inline Styles  An inline style loses many of the advantages of style sheets by

mixing content with presentation. Use this method sparingly, such as when a style is to be applied to a single occurrence of an element.

A. External Style Sheet-1 Each page must link to the style sheet

using the tag. The tag goes inside the head section:
type="text/css" href="mystyle.css" />

The browser will read the style

definitions from the file mystyle.css, and format the document according to it.

A. External Style Sheet-2 An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension.  An example of a style sheet file is shown below:

hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/back40.gif")}

Creating External CSS file  External style sheets allow you to set all the rules for

the entire site in one place, giving your site a consistent look across all the pages. • You must create a text file called mystyles.css. • Type the styles code below into the file. • Notice that this code does not have the <STYLE ...> tag in it: H2 { color:red; font-weight:900; font-family:sans-serif; }

Example

myCSS.css- External CSS File

html File w/ external CSS

OUTPUT of External CSS

B. Internal Style Sheet You define internal styles in the head

section by using the <style> tag, like this:

<style type="text/css"> hr {color: sienna} p {margin-left: 20px} body {background-image: url("images/ back40.gif")}

B. Internal Style Sheet Note: A browser normally ignores unknown tags like

an old browser that does not support styles, will ignore the <style> tag, but the content of the <style> tag will be displayed on the page.

It is possible to prevent an old browser from displaying the content by hiding it in the HTML comment element:

<style type="text/css“>

C. Inline Styles  To use inline styles you use the style attribute in the

relevant tag. The style attribute can contain any CSS property.  The example below shows how to change the color and the left margin of a paragraph:

This is a paragraph



Single Tag CSS CSS can be defined for single tags by simply

adding style="styledefinition:styleattribute;" to the tags. Single tag CSS is used when the style is used in a single place on the entire site.

 Look at this example:

Single Tag Example

It is NOT me.

 NOTE: You should limit your use of single tag CSS.

Multiple Style Sheets If some properties have been set for the same

selector in different style sheets, the values will be inherited from the more specific style sheet. For example, an external style sheet has these properties for the h3 selector:

h3 { color: red; text-align: left; font-size: 8pt }

CSS Layers With CSS, it is

possible to work with layers: pieces of HTML that are placed on top of the regular page with pixel precision.

The DIV tag

http://www.echoecho.com/csslayers.htm

That’s ALL folks… have a happy

WEB DESIGNING day http://www.w3schools.com/css/css_syntax.asp

Related Documents

Web Design With Css
April 2020 4
Web Design And Css
April 2020 7
25.web Mau Css
May 2020 2
Web Design
May 2020 23
Web Design
May 2020 19

More Documents from ""