1.css ()
$ (' P '). CSS (' color ');//get <p> element font Color
$ (' P '). CSS (' Color ', ' red ');//set <p> element's font color is red
$ (' P '). css ({' font-size ': ' 30px ', ' Color ': ' Red '});//settings <p> elements multiple style properties
2.offset ()
Gets the relative offset of the element in the current view, with the returned object containing two properties, top and left, only valid for visible elements
var $p =$ (' P '). offset ();//Get offset for <p> element ()
var left= $p. left;//Get left Offset
var top= $p. top;//Get right Offset
3.position ()
Gets the relative offset of the element relative to the nearest position style property set to relative or absolute's grandparent, and the returned object contains two properties, the top and left
var $p =$ (' P '). Position ();//Get <p> element position ()
var left= $p. left;//Get left Offset
var top= $p. top;//Get right Offset
4.scrollTop () and ScrollLeft ()
Gets the distance from the top of the scroll bar of the element and the distance from the left, respectively.
var $p =$ (' P ');
var scrolltop= $p. scrolltop ();//Gets the distance of the element's scrollbar from the top
var scrollleft= $p. ScrollLeft ();//Gets the distance from the left side of the scrollbar of the element
$ (' textarea '). scrolltop (300);//The vertical scroll bar of the element scrolls to the specified position
$ (' textarea '). ScrollLeft (300);//The horizontal scroll bar of the element scrolls to the specified position
Css-dom operation