jquery learning-setting Access Element styles

Source: Internet
Author: User

<! DOCTYPE html>"UTF-8"> <title> access and set element styles </title> <script src="Js/jquery.js"></script> <style>. divstyle{border:5px Solid black; Background-color:silver; }. Trstyle{background-color:lightskyblue;;            color:black;        }            . </style> <script type="Text/javascript">//page loading complete shorthand form$ (function () {//Set cell width 100px                //$ ("td"). css ("width", "300px");                //$ ("td"). css ("font-size", "30px");                //$ ("td"). css ("color", "red");                //$ ("td"). CSS ("border", "1px solid red");                $("TD"). CSS ({"width":"300px","font-size":"30px","Color":"Red","Border":"1px solid Red"})                                //gets the div background color, css can set element properties, can also get CSS properties                varColor= $ ("Div"). CSS ("Background-color");                                Alert (color); //Set zebra crossing, alternating background color to blue, font to black odd even lines, if you set multiple classes plus, number separated$("tr:odd"). addclass ("Trstyle"); //Move out the CSS style of the corresponding element, move out of the Div's style, or move out of all CSS styles if no arguments are worn$("Div"). Removeclass ("Divstyle"); })                </script> class="Divstyle"> <table> <tr><td> user name 1</td><td> password 1</td></tr> <tr><td> User name 2</td><td> password 2</td></tr> <tr><td> username 3&lt ;/td><td> password 3</td></tr> <tr><td> user name 4</td><td> password 4</td>< /tr> <tr><td> user name 5</td><td> password 5</td></tr> <tr>&lt ;td> User name 6</td><td> password 6</td></tr> <tr><td> username 7</td><td> password 7&                lt;/td></tr> <tr><td> username 8</td><td> password 8</td></tr> <tr><td> User name 9</td><td> password 9</td></tr> <tr><td> username 10</td&gt ;<td> password 10</td></tr> </table> </div> </body>

jquery learning-set Access element styles

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.