dom属性和html属性_HTML属性
dom屬性和html屬性
Attributes are used to provide additional information of a tag such as it’s alignments, color, size of the text and other. The attributes are given with the tag that is between the angular brackets after the tag name. The attributes have a name and a value. The attribute value is given after the name of the attribute with an equals to the symbol. The attributes are specified with the starting tag of the element. The value of the attribute is generally given within the double-quotes. The value could also be specified in single quotations.
屬性用于提供標簽的其他信息,例如標簽的對齊方式,顏色,文本大小等。 在標簽名稱后的尖括號之間的標簽中給出了屬性。 屬性具有名稱和值。 屬性值在屬性名稱后給出,并帶有等于符號的符號。 使用元素的開始標記指定屬性。 屬性的值通常在雙引號內給出。 該值也可以用單引號指定。
Example:
例:
<FONT SIZE="10"> A TEXT </FONT>In the above example, the FONT is the element tag and the SIZE is the attribute for the tag FONT. The attribute SIZE specifies the property of the font which is visible for the content of the font tag "A TEXT". The size has been assigned a value of "10".
在上面的示例中, FONT是元素標簽, SIZE是標簽FONT的屬性。 屬性SIZE指定字體的屬性,該屬性對于字體標簽“ A TEXT”的內容可見。 大小已分配為值“ 10” 。
一些常用屬性 (Some commonly used attributes)
1) The HEIGHT and WIDTH attribute
1)HEIGHT和WIDTH屬性
The height and width attribute specifies these properties of the element for which it has been used, and they receive the values in pixels. An example to illustrate the height attribute is as follows:
height和width屬性指定已為其使用元素的這些屬性,并且它們接收以像素為單位的值。 一個說明height屬性的示例如下:
<img src="yourimage.jpg" height="42">The above code would generate an image with a height of 10px despite its actual height.
上面的代碼將生成一個盡管實際高度為10px的圖像。
An example to illustrate the width attribute is as follows:
舉例說明width屬性,如下所示:
<img src="yourimage.jpg" width="42">2) The HREF attribute
2)HREF屬性
The href attribute, it specifies the tag the URL of a page where the link has to, also the href attribute is also used to specifies the base URL for all the other related URLs for that page.
href屬性,它指定鏈接必須指向的頁面URL的標簽, href屬性也用于指定該頁面所有其他相關URL的基本URL。
<a href="https://www.yourlink.com">Visit me</a>The href attribute could also be applied to the anchor (a), AREA, BASE and many other tags.
href屬性也可以應用于錨點( a ),AREA,BASE和許多其他標簽。
3) The SRC attribute
3)SRC屬性
The src attribute specifies the location or the URL of the required file which is present at some external source. The file that is specified could be any file such as an image or an audio or any other media file. Below example illustrate the use of src to specify the image address.
src屬性指定在某些外部源上存在的所需文件的位置或URL。 指定的文件可以是任何文件,例如圖像或音頻或任何其他媒體文件。 下面的示例說明了使用src指定圖像地址。
<img src="yourlocationthenimagename.jpg">Another example of the src attribute is when it used to specify a file for the script element.
src屬性的另一個示例是何時用于為腳本元素指定文件。
<script src="myscripts.js"></script>4) The STYLE attribute
4)STYLE屬性
The style attribute is used to specify the style for HTML, that is the presentation of the content on the webpage. It gives the inline style to the element. The style attribute could be used for most of the elements as it affects the display of that element.
style屬性用于指定HTML的樣式,即網頁上內容的表示形式。 它為元素提供了內聯樣式。 樣式屬性可用于大多數元素,因為它會影響該元素的顯示。
Example:
例:
<p style="color:green">This is a paragraph.</p>5) The ALT attribute
5)ALT屬性
The alt attribute is used to specify a piece of alternative information to the element. This alternative information could be for an image if in case the image is not displayed to the user.
alt屬性用于為元素指定一條替代信息。 如果未將圖像顯示給用戶,則該替代信息可以用于圖像。
Example:
例:
<img src="yourimage.jpg" alt=" AN IMAGE ">The other tags where the alt attribute could be used are INPUT and AREA tags.
可以使用alt屬性的其他標簽是INPUT和AREA標簽。
翻譯自: https://www.includehelp.com/html/html-attributes.aspx
dom屬性和html屬性
總結
以上是生活随笔為你收集整理的dom属性和html属性_HTML属性的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: observable_Java Obse
- 下一篇: python 三维图直方图_Python