CSS tips to know

Source: Internet
Author: User

One, the form part


1. prevent textarea text fields from scaling

Resize:none;

2. Removal of initialization textarea dropdown bar

Overflow:auto;

3. How to make the option button in the form, click the text can also be selected?

<lable><input type= "Radio" name= "Sex" value= "female" checked= "checked"/> Female </lable>

4. How to align text vertically this input box

Input{vertical-align:middle;}

5. How do I make a table with 1 pixel thin borders?

#test {border-collapse:collapse;border:1px solid #ddd;}

#test th, #test td{border:1px solid #ddd;}

<table id= "Test" >

<tr><th> name </th><td> teen </td></tr>

<tr><th> Age </th><td>20</td></tr>

</table>

Ii. other Parts

1. How do I make single-line text center vertically inside a container?

#test {height:25px;line-height:25px;}

2. How do I get block-level elements centered?

#test {width:900px;height:200px;margin:0 Auto;}


3. How do I clear a few pixels of blank space below the picture?

Method 1:img{display:block;} Method 2:img{vertical-align:top;}

4. Common link styles

A:link-Plain, inaccessible links

A:visited-links that the user has visited

A:hover-the mouse pointer is over the link

A:active-the moment when the link is clicked

When you set styles for different states of a link, follow these order rules: A:hover must be located after A:link and a:visited a:active must be after a:hover

5. set a container to be transparent

#test {

Filter:alpha (OPACITY=50);

-moz-opacity:0.5;

-khtml-opacity:0.5;

opacity:0.5;

}

In these four lines of CSS statements, the first line is IE-specific, the second line is for Firefox, the third row is for the WebKit Core browser, and the fourth line is for opera.

6.CSS3 Shadow

Outer Shadow:

. Shadow {

-moz-box-shadow:5px 5px 5px #ccc;

-webkit-box-shadow:5px 5px 5px #ccc;

box-shadow:5px 5px 5px #ccc;

}

Inner Shadow:

. Shadow {

-moz-box-shadow:inset 0 0 10px #000000;

-webkit-box-shadow:inset 0 0 10px #000000;

Box-shadow:inset 0 0 10px #000000;

}

Summary: actual combat is the only criterion of the test theory. Do not do, always do not understand the implementation of this principle.

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.