HTML Comments, HTML Classes, HTML id Attribute

0 185

HTML Conditional single multi-line Comments HTML Classes HTML id Attribute

in this tutorial, we will learn about HTML Conditional single multi-line Comments HTML Classes HTML id Attribute

HTML Comments

Comments are special character which browser can’t read and show in browser, comments are only for developer to help debug or to reuse his/her codes. You can use comments to a single lines or to multi lines
We can add comments in HTML document like this way

<!– Write your comments here –>

We can also use comments for debugging because through out comments line we can search that specific line of code to debug errors.

HTML single line comments

HTML multi-line comments

Conditional Comments

You might stumble upon conditional comments in HTML.Conditional comments are used to be executed HTML tags by Internet Explorer only.
<!–[if IE 8]>
…. some HTML here ….
<![endif]–>

HTML Classes

In HTML classes element make it possible to define CSS style for classes of HTML elements, if you have same classes for more than one element then it will apply CSS style to all same classes, if have only one class of element then it will apply to that element only, by applying different class names to different elements you can define different styles to every element. In simple words you can say by applying different classes to different elements you can give height width color size etc to your required class of element without disturbing any other same names HTML elements.

Classing Block/Divisions Elements

It is a block level element used as a container for HTML elements .The <div> tag can contain any other tag. the <div> tag used for block/division in HTML after coming HTML 5 new semantic tags reasonably reduce a lot of <div> tag’s usage, it is still important in html5 where no other semantically appropriate element left that suits the purpose in a Web page development there <div> tag can be used.
Classes div make it possible to apply equal styles for equal <div> elements:

Classing Inline Elements

<span> element is a inline element in html. that can be used as a container for text. Classes <span> make it possible to apply equal styles for equal <span> elements.

HTML id Attribute

HTML id attribute specifies a unique id for your HTML element, id attribute mostly used to point a style sheet for styling and by javaScript to manipulate the element with the specific id.
If you have same ids for more than one element then it will apply css style to all same id’s, If have only one id for one element then it will apply to that element only.
By applying different id’s names to different elements you can define different styles to every element.id is a HTML Global Attributes also.

We can use id attribute to link specific id within page.

To apply style to text through id attribute

HTMLl id Attribute Values

Value Description
id Specifies a unique id for the element.Naming rules Must contain at least one character Must not contain any space characters In HTML all values are case-insensitive.

Comments

comments

Leave A Reply

Your email address will not be published.