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.
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
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:
Note: HTML5 does not support the
In HTML 4.01, the
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!