How to use DIV and span in HTML and CSS?

云罗郡主
Release: 2018-11-05 14:22:19
Original
3347 people have browsed it

This article will help you understand and use "div" and "span" in CSS and HTML, and style them with CSS. The main purpose of using "div" is to divide the main body into smaller parts, while "span" is used to define an area within a row.

How to use DIV and span in HTML and CSS?

One: 1. Use div

in 1.html to open Notepad and type in the basic HTML structure. It basically contains the body inside the HTML.

2. Place the

tag inside the body tag. You must remember that div is a container tag, so it must be followed by a
, such as

for splitting on the page, So you can even use div tags inside
.

Two: 1. In

You can use # to make an ID for your

, or just simply write the div and set it's height, width, etc. But when you have many divs, it's better to use an ID.

2. Use span

to put the tag and write some text, then close it with . The span tag is typically used to select a portion of a row and apply certain properties to it. However, you can use it to select multiple rows.

Tip:

Always remember that

and are container tags and therefore need to be closed.

You can create one big

and put many
inside it.

You can use

instead of using tables to layout your website.

The above is a complete introduction to how to use DIV and span in HTML and CSS. If you want to know more about CSS3 tutorial, please pay attention to the php Chinese website.


The above is the detailed content of How to use DIV and span in HTML and CSS?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!