Docsity

Formatting blocks in html, Study notes of Computer Science

Toggle sidebar
bg1
Formatting Blocks of Information
Divisions
The <div> tag is used to structure HTML document into sections or
divisions. A <div> is a logical block tag that has no predefined meaning or
rendering Divisions are more significantly useful when used in conjunction with
style sheets. Rather then applying the formatting to the element itself a <div> - - - -
- </div> pair of tags are wrapped around the element. Any formatting that needs
adding is placed inside the div tag.
Syntax:
<div [id=”- - - - -“][class=”- - - - - “|style=”- - - - -“]> - - - </div>
The <div> tag has “id” so that it can be identified by other elements on the
page.
<div Class = “any element”>
<p> - - - - - - - - </p>
<h2> - - - - - - - - </h2>
<hr>
</div>
Example Program:
<head>
<title>HTML div Tag</title>
</head>
<body>
<!-- First group of tags -->
<div style = "color:red">
<h4>This is first group</h4>
<p>Following is a list of vegetables</p>
<ul>
<li>Beetroot</li>
<li>Ginger</li>
<li>Potato</li>
<li>Radish</li>
pf3
pf4

Partial preview of the text

Download Formatting blocks in html and more Study notes Computer Science in PDF only on Docsity!

Formatting Blocks of Information

Divisions

The tag is used to structure HTML document into sections or divisions. A is a logical block tag that has no predefined meaning or rendering Divisions are more significantly useful when used in conjunction with style sheets. Rather then applying the formatting to the element itself a - - - -

  • pair of tags are wrapped around the element. Any formatting that needs adding is placed inside the div tag. Syntax: **** - - - The tag has “id” so that it can be identified by other elements on the page. **

    - - - - - - - -


Example Program:

HTML div Tag This is first group <p>Following is a list of vegetables</p> Beetroot Ginger Potato Radish 

This is second group

Following is a list of fruits

Apple Banana Mango Strawberry

Output: