How to center text and pictures in html? What is the centering code? I believe many people who have just learned CSS will have such questions. Let’s summarize them below. Currently the latest version of HTML (HTML5) does not support the "center" tag, so you need to use CSS style formatting to center the text in your HTML5 document.
1: How to center html text? [Recommended Learning: Html5 Tutorial]
1. Open the HTML document and double-click the HTML document to open it in your computer's default text (or HTML) editor. Find the text, paragraph or other text you want to center, we add the "center" tag to the text, the syntax is:
p>"), the "center" label can extend beyond the existing labels:
Code example:
<DOCTYPE html> <html> <body> <h1><center>欢迎来到我的网站</center></h1> <center>php中文网</center > <p1>本网站的目的是php在线学习</p1> </body> </html>
Code display effect:
2: How to center pictures in html?
Create a new element and center the element. You can include an image within this centered element. However, it creates extra space around the element.
Start a new line of code. Start by centering the element. Enter
Add image code. Enter
We can specify the height and width of the image. Enter style="max-width:90%" width="200"> or another size of your choice, this is the end of the section that marks the image.
Use
<center><img src =“dancingdogpicture.gif”alt =“dance dog”align =“middle></center>
The above is how to center HTML text and images? A complete introduction to what the centering code is. If you want to know more about HTML5 Online Manual, please pay attention to the php Chinese website.
The above is the detailed content of How to center html text and images? What is the centering code?. For more information, please follow other related articles on the PHP Chinese website!