Summarize knowledge of HTML img, scirpt, link tags

Original link: https://www.mk2048.com/blog/blog.php?id=h021b0a20bib&title=HTML%E7%9F%A5%E8%AF%86%E7%82%B9%E6%80%BB%E7 % BB% 93% E4% B9 % 8Bimg% E3% 80% 81scirpt% E3% 80% 81link% E6% A0% 87% E7% AD% BE
  • <Img> element

Use <img> can insert a picture on the page, but in fact <img> tag does not insert images directly in the web page, but the link from the image on the page.

  • <Img> primary attribute

(1) src attribute: the path of the picture.

(2) alt attribute: When the alternate text when images can not be displayed, so that search engine crawlers.

Text to display when the mouse was suspended: (3) title attribute.

 

(4) height attributes: height of the image.

(5) width attributes: height of the image.

  • <Script> element

Its role is embedded or referenced executable scripts in HTML or XHTML document. This label js code defined only directly, but also capable of introducing external js file, of course, different formats.

  • Common Properties <script> element

1. src attribute: src attribute specifies the URL of an external script file.

If you want to run the same JavaScript on several pages in your site, you should create an external JavaScript file, rather than repeating the same scripting. The script file name extension .js save, and then refer to it using the src attribute in <script> tag.

Possible values:

  1. Absolute URL - points to another web site (such as src = "http://www.example.com/example.js")
  2. Relative URL - points to a file within the site (such as src = "/ scripts / example.js")

2. type Attributes: type attribute specifies the MIME type of the content between the script, identifying <script> and </ script> tag.

MIME type comprising two parts: media type and subtype. For JavaScript, MIME type is "text / javascript". Some common values ​​are:

  • text / javascript (default)
  • text/ecmascript
  • application/ecmascript
  • application/javascript
  • text/vbscript
  • <Link> element

link element specifies the relationship external resources to the current document, with attribute href, rel, media, hreflang, type and sizes. Href rel and which are commonly used. This label is the most commonly used is the introduction of an external css file, although you can directly define the css code <style> tag, but if css code is relatively large, it is bound to cause a page huge, not only easy to manage, and can not be reused css code.

<Link> element common properties:

href attribute: specifies the address of the link resources (url)

rel attribute: rel specifies the type of resource.

We have the following values:

alternate - Links to alternative version of the document (such as print page, translated or mirror).

author - link to the author of the document.

help - links to help documentation.

icon - the icon representing the imported document.

license - Link to copyright information of the document.

next - indicates that the document is part of the set, and the next document set is referenced document.

prefetch - provisions should target resources cache.

prev - indicates that the document is part of the set, and a document set on the document is referenced.

search - links to a search tool for the document.

stylesheet - URL you want to import the style sheet.


More professional front-end knowledge, make the [2048] ape www.mk2048.com

Guess you like

Origin blog.csdn.net/weixin_39037804/article/details/102758354