If there is more than one nested DIV, then how do I set them to DIV at the center of another div at once.
Example: I want to change the value from $ ('# thiWrapper)
to $ (' # moving ')
$ ('# Moving DIV'). CSS ({left: $ ('# on). Wide () / 2 - $ (' # moving DIV '). Width () / 2 / doesNot work});
html:
& lt; Div id = "thiWrapper" & gt; & Lt; Div id = "moving wall" & gt; & Lt; / Div & gt; & Lt; / Div & gt;
css
#moveingDiv {status: relative; } If the set width of the original element (i.e. #thiWrapper) is a good
CSS:
#th wider on {width: 200px; Height: 200px; Background color: blue; } # Flyer dive {width: 100px; Height: 100px; Background color: red; Margins: Auto; }
If you are set dead on implementing this program, the best way to do this is by creating a class with CSS properties that you add and add that element to the jQuery addClass () method By using. For example, you change the CSS in the example given below with CSS.
#thiwerapper {width: 200px; Height: 200px; Background color: blue; } # Flyer dive {width: 100px; Height: 100px; Background color: red; }. Center {margin: auto; }
You can then #moveingDiv Programmatic Center with the code below:
$ ("# movinging"). AddClass (". Center");
and the United Nations Center with the program:
$ ("# movinging"). RemoveClass ("center");
No comments:
Post a Comment