This article focuses on the method of setting the height of label labels in HTML. There is also an introduction to how to use HTML label tags. Let's take a look at this article about HTML label tags.
First, let's look at how to set the height of the label label in HTML:
tags in html <label></label> defining text labels for form elements,<label> is an inline element, there are no line breaks before or after the element, and the height cannot be set.
If you want to set the height, you need to set the display property of <label>, the default property is inline, the element will be displayed as an inline element, the element does not have a line break, just add block after inline, that is, display: Inline-block. At this point <label> change to block element, now you can modify <label> height.
The conditions given in this diagram need to be set <label> width of 80px, at this time <label> is an inline element, cannot directly modify the height, at this time simply change the display property in the code is OK:
<label class= ' p1 ' style= ' dispaly:inline-block ' > name </label>
and set it in the head.
<style>.p1{width:80px;} </style>
So the width is adjusted well.
Now let's talk about how to use the HTML label tag:
The label tag is a label that is used as a "label" in the form of the HTML code, not to be stunned by the phrase, and the "label" is not a label, but it acts as a form to add words to the form to describe it.
In the <form></form> tab, you will find that there is no label between the words, if the text will make the form display error, then introduced the label tag, using the following method:
<form id= "Dreamduform" action= "http://www.php.cn/dreamdu.php" method= "POST" ><label for= "ContactUs" > Topic.alibabacloud.com</label><textarea cols= "rows=" id= "ContactUs" > here is topic.alibabacloud.com </textarea></form>
In this example, the For property is the ID of the form that this label describes, as if the property can be evaluated in JS and the form ID is obtained. I understand that, but I haven't actually tested it.
The above is about the setting height of the HTML label label and the whole content of the use method (want to learn more programming knowledge, come to topic.alibabacloud.com, here have more courses, better teacher for you answer), have the problem can leave a message below.