значения свойства:
* {
margin
:
0
;
padding
}
.wrapper {
width
900px
height
100px
10px
auto
border
1px
solid
#808080
.a {
margin-top
#div
1
, .a, .b {
300px
50px
background-color
#7092BE
* { margin: 0; padding: 0; } .wrapper { width: 900px; height: 100px; margin: 10px auto; border: 1px solid #808080; } .a { margin-top: 10px; } #div1, .a, .b { width: 300px; height: 50px; background-color: #7092BE; }
<!DOCTYPE html>
<
html
>
head
meta
charset
=
"utf-8"
/>
title
>New Page</
link
href
"css/style.css"
rel
"stylesheet"
script
type
"text/javascript"
src
"https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
></
</
body
div
class
"wrapper"
"a"
id
"div1"
"b"
/*JavaScript*/
document.getElementById("div1").style.marginTop = "15px";
/*jQuery*/
$(document).ready(function () {
$(".b").css({ "margin-top": "20px" });
});