+ All Categories
Home > Documents > WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements...

WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements...

Date post: 20-Jul-2020
Category:
Upload: others
View: 8 times
Download: 0 times
Share this document with a friend
38
WEB DESIGN
Transcript
Page 1: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

WEB DESIGN

Page 2: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new
Page 3: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML <div> and <span>

HTML elements can be grouped together

with <div> and <span>.

Page 4: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Block Elements

Most HTML elements are defined as block

level elements or as inline elements.

Block level elements normally start (and end) with a

new line when displayed in a browser.

Examples: <h1>, <p>, <ul>, <table>

Page 5: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Inline Elements

Inline elements are normally displayed without

starting a new line.

Examples: <b>, <td>, <a>, <img>

Page 6: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

The HTML <div> Element

The HTML <div> element is a block level element that can be used as a container for grouping other HTML elements.

The <div> element has no special meaning. Except that, because it is a block level element, the browser will display a line break before and after it.

When used together with CSS, the <div> element can be used to set style attributes to large blocks of content.

Another common use of the <div> element, is for document layout. It replaces the "old way" of defining layout using tables. Using tables is not the correct use of the <table> element. The purpose of the <table> element is to display tabular data.

Page 7: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

The HTML <span> Element

The HTML <span> element is an inline element that

can be used as a container for text.

The <span> element has no special meaning.

When used together with CSS, the <span> element

can be used to set style attributes to parts of the

text.

Page 8: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Grouping Tags

Page 9: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Example - <div> Element

HTML Code Example (A section in a document that will be displayed in blue) :

<p>This is some text.</p>

<div style="color:#0000FF">

<h3>This is a heading in a div element</h3>

<p>This is some text in a div element.</p>

</div>

<p>This is some text.</p>

Page 10: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Example - <div> Element

HTML Results :

Page 11: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Example - <span> Element

HTML Code Example (A <span> element used to

color a part of a text) :

<p>My mother has <span style="color:blue;font-

weight:bold">blue</span> eyes and my father has

<span style="color:darkolivegreen;font-

weight:bold">dark green</span> eyes.</p>

Page 12: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Example - <span> Element

HTML Results :

Page 13: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new
Page 14: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts

Web page layout is very important to make your

website look good.

Design your webpage layout very carefully.

Page 15: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Website Layouts

Most websites have put their content in multiple columns (formatted like a magazine or newspaper).

Multiple columns are created by using <div> or <table> elements. CSS are used to position elements, or to create backgrounds or colorful look for the pages.

Even though it is possible to create nice layouts with HTML tables, tables were designed for presenting tabular data - NOT as a layout tool!

Page 16: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts - Using <div> Elements

The div element is a block level element used for

grouping HTML elements.

The following example uses five div elements to

create a multiple column layout, creating the same

result as in the previous example:

Page 17: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts - Using <div> Elements

<!DOCTYPE html> <html> <body> <div id="container" style="width:500px"> <div id="header" style="background-color:#FFA500;"> <h1 style="margin-bottom:0;">Main Title of Web Page</h1></div> <div id="menu" style="background-color:#FFD700;height:200px;width:100px;float:left;"> <b>Menu</b><br> HTML<br> CSS<br> JavaScript</div> <div id="content" style="background-color:#EEEEEE;height:200px;width:400px;float:left;"> Content goes here</div> <div id="footer" style="background-color:#FFA500;clear:both;text-align:center;"> Copyright © bsg.ac.id</div> </div> </body> </html>

Page 18: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts - Using <div> Elements

The results :

Page 19: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts - Using Tables

A simple way of creating layouts is by using the HTML <table> tag.

Multiple columns are created by using <div> or <table> elements. CSS are used to position elements, or to create backgrounds or colorful look for the pages.

Using <table> to create a nice layout is NOT the correct use of the element. The purpose of the <table> element is to display tabular data!The following example uses a table with 3 rows and 2 columns - the first and last row spans both columns using the colspan attribute:

Page 20: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts - Using Tables

<!DOCTYPE html> <html> <body> <table width="500" border="0"> <tr> <td colspan="2" style="background-color:#FFA500;"> <h1>Main Title of Web Page</h1> </td> </tr> <tr> <td style="background-color:#FFD700;width:100px;"> <b>Menu</b><br> HTML<br> CSS<br> JavaScript </td> <td style="background-color:#EEEEEE;height:200px;width:400px;"> Content goes here</td> </tr> <tr> <td colspan="2" style="background-color:#FFA500;text-align:center;"> Copyright © bsg.ac.id</td> </tr> </table> </body> </html>

Page 21: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Layouts - Using Tables

The Results :

Page 22: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new
Page 23: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Forms

HTML forms are used to pass data to a server.

An HTML form can contain input elements like text fields, checkboxes, radio-buttons, submit buttons and more. A form can also contain select lists, textarea, fieldset, legend, and label elements.

The <form> tag is used to create an HTML form:

<form> . input elements . </form>

Page 24: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

HTML Forms - The Input Element

The most important form element is the <input>

element.

The <input> element is used to select user

information.

An <input> element can vary in many ways,

depending on the type attribute. An <input>

element can be of type text field, checkbox,

password, radio button, submit button, and more.

The most common input types are described below.

Page 25: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Text Fields

<input type="text"> defines a one-line input field

that a user can enter text into:

<form>

First name: <input type="text"

name="firstname"><br>

Last name: <input type="text" name="lastname">

</form>

Page 26: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Text Fields

The Results :

Note: The form itself is not visible. Also note that the

default width of a text field is 20 characters.

Page 27: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Password Field

<input type="password"> defines a password

field:

<form>

Password: <input type="password" name="pwd">

</form>

Page 28: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Password Field

The Results :

Note: The characters in a password field are

masked (shown as asterisks or circles).

Page 29: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Radio Buttons

<input type="radio"> defines a radio button. Radio buttons let a user select ONLY ONE of a limited number of choices:

<form> <input type="radio" name="sex" value="male">Male<br> <input type="radio" name="sex" value="female">Female </form>

Page 30: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Radio Buttons

The Results :

Page 31: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Checkboxes

<input type="checkbox"> defines a checkbox. Checkboxes let a user select ZERO or MORE options of a limited number of choices.

<form> <input type="checkbox" name="vehicle" value="Bike">I have a bike<br> <input type="checkbox" name="vehicle" value="Car">I have a car </form>

Page 32: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Checkboxes

The Results :

Page 33: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Submit Button

<input type="submit"> defines a submit button.

A submit button is used to send form data to a server. The data is sent to the page specified in the form's action attribute. The file defined in the action attribute usually does something with the received input:

<form name="input" action="html_form_action.asp" method="get"> Username: <input type="text" name="user"> <input type="submit" value="Submit"> </form>

Page 34: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Submit Button

The Results :

If you type some characters in the text field above, and click the "Submit" button, the browser will send your input to a page called "html_form_action.asp". The page will show you the received input.

Page 35: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Dropdown List

The Example :

<form action="">

<select name="cars">

<option value="volvo">Volvo</option>

<option value="saab">Saab</option>

<option value="fiat">Fiat</option>

<option value="audi">Audi</option>

</select>

</form>

Page 36: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Send e-mail from a form

<h3>Send e-mail to [email protected]:</h3>

<form action="MAILTO:[email protected]" method="post" enctype="text/plain">

Name:<br>

<input type="text" name="name" value="your name"><br>

E-mail:<br>

<input type="text" name="mail" value="your email"><br>

Comment:<br>

<input type="text" name="comment" value="your comment" size="50"><br><br>

<input type="submit" value="Send">

<input type="reset" value="Reset">

</form>

Page 37: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Send e-mail from a form

The Results :

Page 38: WEB DESIGN - WordPress.comHTML Block Elements Most HTML elements are defined as block level elements or as inline elements. Block level elements normally start (and end) with a new

Try it yourself

Ok, lets practices…


Recommended