Experience and skills frequently used in front-end work

Source: Internet
Author: User
  • Removes all spaces in the string.
    var ss=" fsd fsdaf 23 "; ss.replace(/[ ]/g,"");
  • Remove the dotted border after tag a is clicked
    $(‘a‘).focus(function(){this.blur()});
  • The simplest way to convert a string to a value is-0 (cannot + 0)
    var a = ‘123.45‘; var b = a - 0;
  • In Div, set the vertical text Center Method:
    • Use the line-height method to center a single line of text and set the line-height of the text to be equal to the height of the container.
      height:100px; line-height:100px;
    • Use display: Table-cell to center multiple lines of text and then set vertical-align to center and align
      display:table-cell; vertical-align:middle
    • Align the checkbox and text horizontally: add the style
      vertical-align:middle

      As follows:

      <Input style = "color: red; Vertical-align: middle;" type = "checkbox"/> <label style = "vertical-align: middle; "> I have read <label/>
       I have read
  • Three solutions with invalid span width settings
    • 1. Change span to block type. Add the display attribute to the CSS of span and set span to the block type. The effect is that span completely becomes a div.
       span {           background-color:#fc0;           display:block;           width:150px;        }
    • 2. Add another CSS attribute float on the basis of "1. Basically meet daily needs, similar to Div plus float
      span {            background-color:#fc0;            display:block;            float:left;            width:150px;     }
    • III. (perfect method: directly paste code. The principle can be used to learn CSS in depth)
      span {           background-color:#fc0;          display:-moz-inline-box;          display:inline-block;          width:150px;      }
  • Unfinished...

Experience and skills frequently used in front-end work

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.