Attributes and html elements
Attributes and html elements
BLOCK &
INLINE
ELEMENTS
Attributes:
• Additional information of the element.
• These are always specified in the opening tag.
• If folders are parent then attributes are written in the single quote.
Examples :
1) href attribute: The anchor <a> tag defines the hyperlink. The
href attribute specifies the URL of the page the link goes to.
2) Target attribute: The target attribute specifies where to open the
linked document.
• _self: Default. Opens the document in the same window/tab as it was
clicked.
• _blank: Opens the document in a new window.
• _parent: Opens the document in parent frame.
• _top: Opens the document in the full body of the window.
3) src attribute: The src attribute specifies the path to the image
to be displayed. The <img> tag is used to
embed an image in an html page. The <img> tag should
also contain the width and height attributes, which
specify the width and height of the image. The <img> tag
does not have a closing tag.
4) Alt attribute: The required Alt attribute for the<img> tag
specifies an alternate text for the image, if the
image for some reason cannot be displayed.
5) Style attribute: The style attribute is used to add styles to an
element, such as color, font, size and more.
6) Title attribute: The title attribute defines some extra
information about an element. The value of the title
attribute will be displayed as a tooltip when you
mouse over the element.
Block-Level Elements: It will take total width of the
window and automatic line
break.
Examples:
1) <div>: It will act as a container and also divide the page
or to separate the sections.
2)<p>: The <p> tag defines a paragraph.
3)<h1> to <h6>: The <h1> to <h6> tags are used to
define HTML headings. <h1> defines
the most important heading and <h6> defines
the least important heading
4)Manual break: The <br> tag inserts a single line break.
5) <ol>: The <ol> tag defines an ordered list. An ordered
6) <ul>: The <ul> tag defines an unordered list. It can be circle,
square, disk(default).
7)<li>: The <li> tag defines the list item. It is used in ordered list
and unordered list.
8)<section>: The <section> tag defines a section in a document.
9)<table>: The <table> tag defines an HTML table. An HTML table
consists of one <table> element and one or more <tr>, <th>,
and <td> elements. The <tr> element defines a table
row , the <th> element defines a table head, and the <td>
element defines a table cell/ table data.
10)<address>: The <address> tag defines the contact information
for the owner of the document. Ex: email, URL,
cell no, physical address, social media handles etc.
Inline Elements: It will take width of the content.
Examples:
1) anchor tag: The <a> tag defines a hyperlink, which is used to
link from one page to another. The most important
attribute of the <a> element is the href
attribute, which indicates the links destination. By default
link will appear as follows in all browsers.
1) An unvisited link is underlined and blue.
2) A visited link is underlined and purple.
3) An active link is underlined and red.
2) <span>: The <span> tag is used for single line.
3)<select>: The <select> element is used to create a drop-
down list. It is most often used in a form, to collect a
user input. The <option> tags inside the <select>
element defines the available options in the drop-down
list.
4)<label>: The <label> tag defines a label for several
elements.
5)<button>: The <button> tag defines a clickable button.
6) <textarea>: The <textarea> tag defines a multi-line text
input control. The <textarea> element is often
used in a form, to collect user inputs like
Thank you