A little understanding of the HTML label label

Source: Internet
Author: User

The label label defines the callout for the INPUT element.

The label element does not render any special effects. But he has improved usability for mouse users. This control is triggered if you tap text inside a LABEL element. This means that when the user chooses the tag, the browser automatically shifts the focus to the controls that are related to the form.

It has two properties for the from.

The for rule binds to which form element. (The For property value of the label element must be the same as the id attribute value of the related form element)

One or more forms to which the From Rule field belongs.

Example: Common Web side bar pop-up effect can also be fully implemented with CSS animation. The label tag is now applied.

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Document</title>    <style>        *{margin:0;padding:0;        }P{padding:10px 0;        }Body{Min-height:100%;        }input{Display:None;        }aside{position:Absolute; Left:-200px;Top:0;Bottom:0;width:200px;Background-color:#BB6868;
transition:0.25s ease-out; -webkit-transition:0.25s ease-out; }#sidebutton: Checked + aside{ Left:0; }#sidebutton: Checked ~ #wrap{Padding-left:220px; }#wrap{Margin-left:20px;padding:10px;
transition:0.25s ease-out; -webkit-transition:0.25s ease-out; }#wrap >label{Border:None;Background-color:Green;Color: White; }#wrap >label:hover{background:#000; } </style></Head><Body> <inputtype= "checkbox"ID= "Sidebutton"> <aside>Navigation bar</aside> <DivID= "Wrap"> <label for= "Sidebutton">Menu</label> <P>HTML and CSS for sidebar popup effects</P> </Div></Body></HTML>

This example shows the application of label labels very well. With the combination of label and input in the application of CSS animation can be very good to solve some simple click animation above the page. (PowerPoint effect slides can also be implemented with this)

A little understanding of the HTML label label

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.