How to Define a Section in a Document in HTML

By eHow Internet Editor

Rate: (0 Ratings)

Defining sections in a web page allows you to group content and control how it's displayed. Once a section has been defined, for example, it can easily be centered or otherwise formatted. Sections resemble paragraphs in that they contain text or additional HTML elements.

Instructions

Difficulty: Moderately Easy

Things You’ll Need:

  • Text file editor

Define a Section

Step1
Open your web page document in your web editing program. Position the cursor wherever you want the section to begin.
Step2
Type the following:

. This is the material inside this section of the document:
Step3
Replace "main-section" with a unique name that defines the section and that you will later use to refer to the section in code.
Step4
Replace "#FF0000" with a hexadecimal number or color name specifying the color you want this section's text to take.
Step5
Replace "This...section" with all the text, containers, code and controls that you want this section to contain.
Step6
Close the section with the following:

Tips & Warnings

  • It's a good idea to give each section a name, by setting its "ID" attribute. This allows you to refer to it from script, for instance.
  • Don't define section tags inside paragraph tags. Since both are containers but of different kinds, it doesn't make sense to do so.

Post a Comment

POST A COMMENT

Request a New How-To Article

Looking for more How To information? Chances are there’s an eHow member who knows how to do what you’re looking to do. Submit an article request now!

eHow Article:  How to Define a Section in a Document in HTML

eHow Internet Editor

eHow Internet Editor

Category: Internet

Articles: See my other articles

Related Ads

Internet

Veesites
Meet Virginia DeBolt eHow’s Internet Expert.