Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use inline style, internal style sheet and external style sheet in HTML

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use inline styles, internal style sheets and external style sheets in HTML. The article is very detailed and has certain reference value. Interested friends must read it!

HTML link

HTML uses hyperlinks to connect to another document on the Web.

Links can be found in almost all web pages. Click on links to jump from one page to another.

HTML Hyperlink (Link)

A hyperlink can be a word, a word, a group of words, or an image that you can click on to jump to a new document or a section of the current document.

When you move the mouse pointer over a link in a web page, the arrow changes to a small hand.

We create links in HTML by using tags.

There are two ways to use labels:

Create a link to another document by using the href attribute-

Create bookmarks within documents by using the name attribute-

HTML link syntax

The HTML code for the link is simple. It looks like this: Link text

The href attribute specifies the target of the link.

The text between the start and end tags is displayed as a hyperlink.

examples

This is a link

The above line of code appears as text with a hyperlink: This is a link

Clicking on this hyperlink will take the user to www.example.com. http://www.yisu.com/

Tip: "Link text" doesn't have to be text. Images or other HTML elements can be links.

HTML link- target attribute

Using the Target attribute, you can define where linked documents appear.

examples

Open document in new window

HTML link- name attribute

The name attribute specifies the name of the anchor.

You can use the name attribute to create bookmarks in HTML pages.

Bookmarks are not displayed in any particular way, they are invisible to the reader.

When using named anchors, we can create a link that jumps directly to the named anchor (say, a section of the page), so that users don't have to scroll through the page to find the information they need.

Syntax for naming anchors:

Anchor (text displayed on the page)

Tip: The anchor name can be any name you like.

Tip: You can use the id attribute instead of the name attribute, and named anchors work as well.

examples

First, we name the anchor in the HTML document (create a bookmark), and then we create a link to that anchor in the same document, and we can also create links to that anchor in other pages.

In the above code, we add the #symbol and anchor name to the end of the URL to link directly to the named anchor tips.

Basic Considerations-Useful Tips:

Note: Always add forward slashes to subfolders. If you write a link like this: href="http://www.yisu.com/html," you will make two HTTP requests to the server. This is because the server adds a forward slash to the address and creates a new request, like this: href="http://www.yisu.com/html/".

Tip: Named anchors are often used to create directories at the beginning of large documents. You can assign a named anchor to each chapter and place links to those anchors at the top of the document. Such as Baidu Encyclopedia.

Tip: If the browser cannot find a named anchor defined, it navigates to the top of the document. There will be no mistakes.

The above is "How to use inline style, internal style sheet and external style sheet in HTML" all the contents of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

  • What is the custom button style in the css3 fillet style

    Css3 fillet style in the custom button style, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something. The code is as follows:

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report