Web Standards FAQ Collection 3_ Experience Exchange

Source: Internet
Author: User
What is the difference between the definition ID and class in the 10.web standard?
<textarea id="runcode54285"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < Meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/> <style type=" Text/css "> <!--#aa {color:red}. aa {Color:blue}--&L T;/style> aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</textarea>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
One.

Web standards are not allowed to duplicate ID, such as div id= "AA" is not allowed to repeat 2 times, and the class is defined by classes, theoretically can be infinitely repeated, so that the definition of multiple references can be used.

Two.
Priority issues for attributes
The priority of ID is higher than class, see the example above

Three.
Convenient JS and other client-side script, if you want to script an object in the page, then you can define an ID, otherwise can only be used to traverse the page element plus specify a specific attribute to find it, this is a relatively waste of time resources, far less than a simple ID.
11. How to center text vertically
<textarea id="runcode45999"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < Meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/> <style type=" Text/css "> <!--div {height:30px; line-height:30px; BORDER:1PX Solid Red}-</style> Web standards FAQs</textarea>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
Set a container with the same height as it would be.
12. How to align text and input baskets
<textarea id="runcode23973"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 strict//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > < Meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/> <style type=" Text/css "> <!--input {width:200px; height:30px; border:1px solid red; --</style> <input type= "text"/>aaaaaaaaaaaaaaaaaa</textarea>
[Ctrl + A full selection Note: If you need to introduce external JS need to refresh to execute]
If you encounter this problem, set the vertical-align:middle of the text box.
  • 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.