HTML Hypertext Markup Language (ii) several common tags and attributes in-html

Source: Internet
Author: User

several common tags and their properties in HTMLone, HTML link tag:<a></a>

1.Herf Properties : Create a label ( hyperlink ) that points to another document

Grammatical structure: <a href=url ">link text</a>

Note: "Link text" does not have to be text, and a picture or other HTM element can also be a link.

2. Nameattribute : Specifies the title of the anchor for creating bookmarks within the document ( anchor )

The syntax structure is as follows.

Named anchor: <a name= "Tip" > Basic considerations-Helpful tips </a>

Create a link to the anchor in the same document: <a href= "#tip" > Helpful tips </a>. Click on the phrase "useful hints" and the page will jump to the previously named anchor (bookmark).

Create a link to the anchor in another page: <a href= "Url#tip" > Helpful tips </a>. URL is the URL of the page where the anchor is located, add the # symbol and the anchor name to the end of the URL, you can link to the tip of the named anchor.

3.Target Property : Defines where the linked document is displayed.

Syntax structure: <a href= "url" target= "_blank" ></a>

"_bank" means that the link is opened in a new window, and if the link content is locked in the frame, "_top" indicates that the frame is out.

Second, image label

The image label is an empty label, contains only attributes, and does not have an end tag.

1. Definition Image:

SRC is the Source property , and the value is the URL address of the image. If the image named "Boat.jif" is in the images directory of www.w3cschool.com.cn, its URL is: www.w3cschool.com.cn/images/boat.jif

The browser displays the picture in the place where the image label appears.

2, set the background image: <body background= "url" >

Use the Background property in the body tag.

3, arrange the Picture:

The align property is used to set the alignment of an image with values such as Bottem, middle, top, left, and right (the image floats to the left of the text). The default is bottom.

4, adjust the image size:

You can adjust the image size by changing the value of the width and Height properties .

5. Make Image link:

<a href= "to point to hyperlink address" ></p>

You can use the image as a hyperlink. The border property is used to set the border of an image.

6. Replace text for image display:

alt-Replace text properties tell readers about lost information when the browser fails to load the image. It is a good practice to add alternate text properties to the images on the page.

Note: The difference between the SRC attribute and the href attribute.

In general, SRC is used to replace the current element, and the href is used to establish a connection between the current document and the referencing resource.

SRC is the abbreviation for source, pointing to the location of the external resource, which is embedded in the document where the current label is located, and when the SRC resource is requested, it points to the resource to download and apply to the document. Examples include JS scripts, IMG images, and frame elements. <script src= "Js.js" ></script>

When the browser resolves to the element, it pauses the download and processing of other resources until the resource is loaded, compiled, and executed. The picture and frame elements are similar. That's why the JS script is placed at the bottom instead of the head.

HREF is the abbreviation for hypertext reference, which points to the location of the network resource, establishes the link between the current element (anchor point), or the current document (link).

HTML Hypertext Markup Language (ii) several common tags and attributes in-html

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.