Skip to content

Commit 9bd6d1d

Browse files
committed
Attribute vs Property
1 parent e8d6442 commit 9bd6d1d

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1928,14 +1928,37 @@ A canonical tag is a way of telling search engines that a specific URL represent
19281928
One of the most important features of HTML5 is its semantics tags. Semantic tags refers to syntax that makes the HTML more comprehensible by better defining the different sections and layout of web pages. It makes web pages more informative and adaptable, allowing browsers and search engines to better interpret content. For example, instead of using `<div id="header"></div>` you can use a `<header></hrader>` tag.
19291929

19301930
<p align="center">
1931-
<img src="assets/images/semantic-tags.png" alt="HTML5 semantic tags" width="400px" />
1931+
<img src="assets/images/semantic-tags.png" alt="HTML5 semantic tags" width="250px" />
19321932
</p>
19331933

19341934
<div align="right">
19351935
<b><a href="#">↥ back to top</a></b>
19361936
</div>
19371937

1938-
#### Q. ***What is the difference between an "attribute" and a "property" in HTML?***
1938+
## Q. ***What is the difference between an "attribute" and a "property" in HTML?***
1939+
1940+
Attributes are defined by HTML. Properties are accessed from DOM (Document Object Model) nodes.
1941+
1942+
**Example**
1943+
1944+
```html
1945+
<input id="inputId" type="text" value="Hello World!" />
1946+
```
1947+
1948+
The **value** property reflects the current text-content inside the input box, whereas the **value** attribute contains the initial text-content of the **value** attribute from the HTML source code
1949+
1950+
**Difference between HTML attributes and DOM properties:**
1951+
1952+
|Attribute |Property |
1953+
|----------------------------------------|------------------------|
1954+
|Attributes are defined by HTML. |Properties are defined by the DOM.|
1955+
|The value of an attribute is constant. |The value of a property is variable.|
1956+
|These are used to initialize the DOM properties. After initialization, the job is finish.| No such job defined.|
1957+
1958+
<div align="right">
1959+
<b><a href="#">↥ back to top</a></b>
1960+
</div>
1961+
19391962
#### Q. ***How do you set IE compatibility mode?***
19401963
#### Q. ***What is an optional tag?***
19411964
#### Q. ***Have you used different HTML templating languages before?***

0 commit comments

Comments
 (0)