HTML/C3/Block-Elements-and-Layouts/English
Title of the script: Block Elements and Layouts
Author: Praveen S
Domain Reviewer: M.Deivamani
Novice Reviewer: Madhulika G
Keywords: HTML, block elements, inline elements, web layout, div tag, span tag, HTML5 Layout, header, footer, navigation, article, aside, Spoken Tutorial, Video Tutorial
Visual Cue | Narration |
Slide: Introduction | Hello and welcome to the spoken tutorial on Block Elements and Layouts in HTML. |
Slide: Learning Objectives | In this tutorial we will learn about:
|
Slide: Prerequisite |
|
Slide: System Requirements | To record this tutorial, I’m using
However you may use any other editor or browser of your choice. |
Slide: Code Files |
|
Slide: HTML Elements | Elements in HTML are classified into two types.
|
Slide: Block Level Elements |
|
Slide: Inline Elements | Whereas
|
Slide: BlocK Level Elements
|
These are some of the block level elements. |
Slide: Inline Elements
|
These are some of the inline elements. |
Only narration | In this tutorial we will learn about div and span tags. |
Slide: div tag |
|
Let us see an example of this. | |
Open layout.html in gedit | For this demonstration, I have written some code and saved it as layout.html
I have already opened this file in a text editor. |
Highlight 2nd div block | I have created a section for News and added some content in it using the div tag. |
Highlight 3rd div block | Next I have created a section for an article about Spoken Tutorials on Web Technology. |
Highlight 1st div block | I have written both these div blocks in an outer div block. |
Open layout.html in firefox | Open this file in a web browser to see the output. |
Highlight the output | Observe the output.
It’s just a simple text without any styles or formatting. |
Only narration. | Switch back to the text editor. |
|
Inside the second div tag let us add some styles.
Update the code as shown here. |
Highlight float: left; | Inside the style attribute, I have set the float property value as left.
This will align the elements to the left of the container. |
Highlight
width:20%; height:50%;background-color:#ff90ff;" |
I have set some more attributes like width, height and background color. |
|
Likewise, let me add the styles for the 3rd div tag as shown here. |
Highlight width:20%; in 2nd div tag | In the 2nd div tag, I have set the width as 20%. |
Highlight width:80%; in 3rd div tag | In the 3rd div tag, I have set the width as 80%. |
Only narration | So this setting will split the display area as 20% for the 1st section and 80% for the 2nd section. |
Press Ctrl + S | Save the file. |
Refresh the browser | Switch to the browser once again and refresh the page. |
Highlight the output | Observe the change.
Our simple text page has now changed into a two column layout. Likewise, we can create many other layouts on our own, using the div tags and styles. |
Note |
|
Note (contd.) |
|
Slide: span tag | Now let us learn about the span tag.
Span tag can be-
|
Switch to layout.html in gedit | Switch to the text editor.
Here let me set different colours for each list item using the span tag. |
<ul>
<li> <span style = "background-color:green"> PHP & MySQL </span> </li> <li> <span style = "background-color:yellow"> Joomla </span> </li> </ul> |
Update the code as shown here. |
Highlight the list items | For each list item, I have set a different background colour using the span tag. |
Press Ctrl + S | Save the file. |
Refresh the browser | Switch back to the browser and refresh the page. |
Highlight the output | Observe the output now.
Each list item appears in a different background colour. |
Come back to the text editor. | |
<ul>
<li> <span style = "background-color:green; color:yellow;"> PHP & MySQL </span> </li> <li> <span style = "background-color:yellow; color:blue;"> Joomla </span> </li> </ul> |
Let us change the colour of the text as well.
Update the code as shown here. |
Press Ctrl + S | Save the file |
Refresh the browser | Switch back to the browser and refresh the page. |
Highlight the output | Observe the output now.
Each list item appears in a different text colour and background colour. |
Slide: HTML5 Layout |
|
Slide: HTML5 Layout |
These tags have a start and an end. With the help of layout elements and CSS we can create attractive web layouts. We will discuss this in detail in a later tutorial. |
Only narration | With this we come to the end of the tutorial.
Let us summarise. |
Slide: Summary | In this tutorial, we have learnt about:
|
Slide: Assignment | As an assignment-
|
Slide: About Spoken Tutorial project | The video at the following link summarizes the Spoken Tutorial project.
Please download and watch it. |
Slide: About Workshop | The Spoken Tutorial Project team conducts workshops and gives certificates.
For more details, please write to us. |
Slide: Forum questions | Please post your timed queries in this forum. |
Slide: Acknowledgement | Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
More information on this mission is available at this link. |
Slide: Thanks | This is Praveen from IIT Bombay signing off.
Thank you for joining. |