How do I set the height of a label label in HTML? How label labels are used

Source: Internet
Author: User
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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.