Add paragraph and set the style : css function « jQuery « JavaScript DHTML






Add paragraph and set the style

    

<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
           $("div").css("color", "red").add("p").css("background", "yellow");
        });
    </script>
    <style>
      div { width:40px; height:40px; margin:10px; float:left;}
    </style>
  </head>
  <body>
    <body>

          <div>asdf</div>
          <div>asdf</div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
          <div></div>
  </body>
</html>

   
    
    
    
  








Related examples in the same category

1.Add border to DIV
2.Define CSS in an array and set
3.Get CSS value
4.Set two CSS value in CSS function
5.Nested style setting
6.Use the rgb function with JQuery
7.Use CSS value when creating new tag
8.The basic CSS Selectors supported by jQuery
9.css(name): Return a style property on the matched element.
10.css(properties): set several style properties on matched elements.
11.css(name, value): If a number is provided, it is automatically converted into a pixel value.
12.Adds a background and text color to all the headers on the page.
13.Sets the background color of the page to black.