" tag to make the div appear in the center without writing css."/> " tag to make the div appear in the center without writing css.">

Home  >  Article  >  Web Front-end  >  How to make div appear centered without writing css

How to make div appear centered without writing css

藏色散人
藏色散人Original
2023-02-02 09:16:232019browse

How to center the div without writing css: 1. Create an HTML sample file; 2. Define some p tag content; 3. Use the "

" tag to achieve without writing CSS can also center the div.

How to make div appear centered without writing css

The operating environment of this tutorial: Windows 10 system, CSS3 version, DELL G3 computer

How to achieve centered display of divs without writing css ?

You can use the

tag.

Centers the text it contains horizontally.

Example

Horizontally center the text in the HTML web page:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title></title> 
</head>
<body>

<p>这是一些文本。</p>
<center>这个文本居中对齐。</center>
<p>这是一些文本。</p>

</body>
</html>

The effect is as follows:

How to make div appear centered without writing css

Note: HTML5 does not support the

tag. Please use CSS instead.

In HTML 4.01, the

element is deprecated.

Recommended learning: "css video tutorial"

The above is the detailed content of How to make div appear centered without writing css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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