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...
Step-by-Step Guide
-
Step 1: Open Notepad and type down the basic HTML structure.
It basically contains body inside HTML. -
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! -
Step 3: In the <style>
-
Step 4: give the <div> an ID and set its height
-
Step 5: background-color
-
Step 6: Put the <span> tag and write some text and then close it with </span>.
-
Step 7: Give you span an ID and set its properties.
-
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
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.
Rate This Guide
How helpful was this guide? Click to rate: