What is the center attribute in HTML? Center of HTML text and pictures (with examples)

Source: Internet
Author: User
This article describes the Align property in HTML, describes how the Align property is centered on text, and how the HTML align property is centered on the image, so let's take a look at this article.

First of all, let's say the center attribute in HTML:

Today we recommend the use of the Align attribute, the Align attribute can be used in many tags, this article mainly introduces the use of align attributes to the text and Picture Center display.

Now let's say that the HTML Align property centers the text, so let's look at a complete code:

<!doctype html>

This is a simple code that shows the effect,

What you see is not implemented with any tags, which is displayed by default in the top left of the browser.

Now we want to center the text above, how should we do it?

Yes, that's the Align property that I introduced at the beginning of the article. Let's add the align attribute to it.

Now look at the code:

<!doctype html>

Because the text label is originally used to summarize the paragraph P tags, so we use the P tag, which adds a align attribute equals center. is to have all the text in the P tag centered. Let's look at the effect:

This is all displayed in the middle of the browser.

This is the way the HTML align property is centered on the text. (Want to see more, here are Topic.alibabacloud.com's HTML online video tutorial)

Now let's take a look at the center of the picture with the Align attribute:

All know that the picture label is displayed with this single label, so the code shown is as follows:

<!doctype html>

I added a network image to the above code, now look at the effect:

Obviously, this image is displayed at the top left of the browser's default. Now let's try adding the IMG tag to the align attribute:

<body><p align= "Center" > This is a piece of text, without any tags, see where I am now </p></body>

Above I added the Align attribute, then the effect quickly changed, this certainly must in html4.01 inside can use. So I'm not going to show the picture here. Everyone can read it.

This article about the Align property of HTML to the end of this, there is a problem can be in the message below.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.