Hey!!! How are you doing!! In this post we will be checking our definition lists in html.
what is definition lists?
Definition lists allow you to have terms along with their descriptions as list items.
example: Definition Lists In Html
So I have an html file here,
<!DOCTYPE html> <html> <head> <title>Definition Lists In Html</title> </head> <body> <h2>Just like that!!</h2> <dl> <dt>Roger Federer</dt> <dd>Tennis player</dd> <dt>Lionel Messi</dt> <dd>Football player</dd> <dt>Sachin Tendulkar</dt> <dd>Cricket player</dd> </dl> </body> </html>
Inside the body section I have a heading tag. Between the opening and closing <h2> tags I have the heading as “Just like that!!”.
Then I have the tag <dl> or the element “dl”. And “dl” is a short form for definition list.
You know it’s easy to remember that way. Then to have the terms you use the <dt> tags and to have their definitions you use the <dd> tags.
Together these make one list item. So in between the opening <dt> tag and the closing <dt> tag I have the text “Roger Federer”.
And the opening and closing <dd> tags to have the description of the text of <dt> tag. So “Roger Federer” is a tennis player. That’s why I have written tennis player.
Also Read – Learn Inserting Images In Html
Similarly I have the opening and closing <dt> tag in between that I have the text “Lionel Messi”.
In the next line I have the opening and closing <dd> tags to include the description of “Lionel Messi” and Lionel Messi is a football player.
Descriptions mentioned above can be as elaborate as you want them to be. I just included single line you know sort of descriptions.
I have again the opening and closing <dt> tags and an another term which is “Sachin Tendulkar” and in the next line I have opening and closingtags to enclose the text “Cricket player”.
Because Sachin Tendulkar is a cricket player. So save the file and open in google chrome,
This is how it looks. We have heading on the top and then we (as you can see above) have these list items.
So Roger Federer is a tennis player, Lionel Messi is a football player and Sachin Tendulkar is a cricket player.
That’s it for this post. I hope you have understood the definition lists in html. You may subscribe to my blog and share across in social networks.