How to Use DIV and Span in HTML and CSS

Open Notepad and type down the basic HTML structure., Put the tag inside the body tags., In the , give the an ID and set its height, width, background-color, etc., Put the tag and write some text and then close it with ., Give you span an ID and set...

8 Steps 1 min read Medium

Step-by-Step Guide

  1. Step 1: Open Notepad and type down the basic HTML structure.

    It basically contains body inside HTML.
  2. Step 2: Put the <div> tag inside the body tags.

    You must remember that div is a container tag so it must have a </div> after it, like <div> </div> <div> is used to make divisions on the page, so you can even use div tags inside a <div>. , You can use # for making an ID for your <div> or just simply write div and set its height, width, etc.

    But when you have many divs, its better to use an ID. , The span tag is generally used to select a part of line and apply some properties to it.

    However you can use it for selecting more than a single line. , You can have multiple spans in a line. , Coding is poetry, match the rhymes and have a long journey!
  3. Step 3: In the <style>

  4. Step 4: give the <div> an ID and set its height

  5. Step 5: background-color

  6. Step 6: Put the <span> tag and write some text and then close it with </span>.

  7. Step 7: Give you span an ID and set its properties.

  8. Step 8: Don't forget to enjoy!

Detailed Guide

It basically contains body inside HTML.

You must remember that div is a container tag so it must have a </div> after it, like <div> </div> <div> is used to make divisions on the page, so you can even use div tags inside a <div>. , You can use # for making an ID for your <div> or just simply write div and set its height, width, etc.

But when you have many divs, its better to use an ID. , The span tag is generally used to select a part of line and apply some properties to it.

However you can use it for selecting more than a single line. , You can have multiple spans in a line. , Coding is poetry, match the rhymes and have a long journey!

About the Author

D

Diana Hughes

A seasoned expert in education and learning, Diana Hughes combines 3 years of experience with a passion for teaching. Diana's guides are known for their clarity and practical value.

65 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: