Introduction to HTML Text Attributes
Html has some features for showing web pages more with user-friendly and also the html documents containing a structure like the nested format for all the html tag elements. As we have seen already, each and every tag element containing opening and closing angle brackets(<>,</>).The Extension of every html element is indicated with the pairs of tags like start and end tags in the html text. There are n number of tags in html for displaying the web pages for customized levels in user perspectives. Some tags like Example <p> paragraph tag is defined under the html document regarding text content shows in web pages.
Syntax:
The html provides many tags for texting attributes in html; it also has some modifiers for the element types.
<html>
<head>
</head>
<body>
<strong> ---some text--</strong>
</body>
</html>
The above code is the basic syntax for the text attributes in html web pages. We also use some other text attributes like “<em>,<mark>,<b>,<small>,<del>,<i>, etc.” these are the basic text attributes in html which we are using in the web pages. We also use some other userdefined or customized text attributes based on user requirements.
Importance of HTML Text Attributes
Generally, the html attributes are the special kind of words in the web documents because they will perform the operations like <> opening and </> closing in html attributes; it will control the behavior of the elements based on the attribute performance in the web pages. The text also attributes modifiers of the html element types upon either modifier it will be noted on the default functionality of the every html element types, or it will provide the functionality to the certain elements’ types unable to certain functions correctly or properly to the html web pages.
In html document attribute is added to the using html start tag and also some of the several basic attributes types like “required attribute” it will be needed by the particular element type for the particular elements type functionality be working properly, and another attribute called “optional attributes” it will be used to modify the default functionality of the html element type the third type like “standard attributes” it supported many html types and finally the “event attributes” is used to cause the html element types to specify the scripts to be run with the under specific circumstances.
Some of the html attributes types of functionality will differ from the modified html element types. The html attributes will call the name with value pairs. Each will be separated with the “=” symbol, and also same will be written with the start tag of the html element after the html element name and value may be enclosed with the single or double-quotes. Also, some of the values that contain certain characters will be left; that is, they will be unquoted from the html. Still, it does not support XHTML, leaving some attribute values that will be unquoted; it may be considered unsafe from the html document. Popular Course in this categoryHTML Training (12 Courses, 19+ Projects, 4 Quizzes)12 Online Courses | 19 Hands-on Projects | 89+ Hours | Verifiable Certificate of Completion | Lifetime Access | | 4 Quizzes with Solutions
4.5 (6,492 ratings)Course Price
₹6999 ₹41999
View Course
Related CoursesBootstrap Training (2 Courses, 6+ Projects)XML Training (5 Courses, 6+ Projects)CSS Training (9 Courses, 9+ Projects)
Most of the html elements will take some common attributes in html; the id attributes like id attribute it will provide the documents for the worldwide format, and also it’s like unique identifiers of the html element it will take the usage of the css selector styles for providing the presentational properties using browsers to focus the attention on the specific html element or anything combined with the script for other contents it should be altered one it is the presentation scenario. In a dynamic web page for the html, we will use the URL methods like get and post, etc. for appending the URL for a web page; it will directly target the specific html elements within the document and also typically a sub-section for the web page the id attributes shown like http://www.examples.com/html#attributes.
Any other attribute like “class” provides the classified html elements, or it looks like similar elements. It can be very much useful for semantic purposes for the html documents for presentation purposes. Moreover, classes are used in microformats types, and html document class type looks like “notation” types; it indicates that all the html elements with this class values are sub co-ordinate with the main html texts for the web-based documents. Such type of html elements must be gathered and combined together with the presentation for header and footer notes on the web pages instead of it appears in the text places where they will occur in the source of the html documents.
Moreover, CSS styles will be the presentation for the web documents user, or the Author will use the css style attributes for both non-attributable codes, which also looks with presentational properties of the html elements. The css style attributes will call the html based documents with the help of the class and id attributes for selecting the html elements with the style sheets for the web pages.<title> also another sub-text based attributes in the html. In most of web browsers, this attribute will be called as the tooltip for the web pages.
Examples of HTML Text Attributes
Following are the examples:
Example #1
Code:
<html>
<body>
<h2>Samples</h2>
<p>Welcome To My Domain</p>
<a href="https://www.gmail.com">Please login</a>
</body>
</html>
Output:
Example #2
Code:
<html>
<head>
<style>
.sample {
text-transform: uppercase;
}
.sample1 {
text-transform: lowercase;
}
.sample2 {
text-transform: capitalize;
}
</style>
</head>
<body>
<p class="sample">Welcome to My Domain.</p>
<p class="sample1">Welcome to My Domain.</p>
<p class="sample2">Welcome to My Domain.</p>
</body>
</html>
Output:
Example #3
Code:
<html>
<head>
<style>
#sample{
font-size: 33px;
font-weight: bold;
font-family: Arial;
color: green;
transition:0.7s;
}
</style>
</head>
<body>
<p id="sample">Welcome To my Domain</p>
<script type="text/javascript">
var b = document.getElementById('sample');
setInterval(function() {
b.style.opacity = (b.style.opacity == 0 ? 1 : 0);
}, 1000);
</script>
</body>
</html>
Output:
Conclusion
We have seen some HTML tags types like text elements; for the web pages, the text tags will be used for basic html documents. Some of the basic tags <h1> to <h10>,<p> etc this type of tags will be used for every html web-based documents. Some tags will be supported for browsers compatibility, and some tags will not be compatible.
Recommended Articles
This is a guide to HTML Text Attributes. Here we discuss the basic concept and Importance of HTML text attributes along with different examples and their code implementation. You may also have a look at the following articles to learn more –