значения свойства:
* {
margin
:
0
;
padding
}
.main {
height
600px
width
900px
position
absolute
top
50%
left
margin-top
-300px
margin-left
-450px
.wrapper {
33.3%
100%
float
#div
1
, #div
2
3
{
200px
relative
-135px
border
1px
solid
#808080
background-image
url
(../img/a.png);
background-repeat
no-repeat
35px
background-origin: padding-box;
* { margin: 0; padding: 0; } .main { height: 600px; width: 900px; position: absolute; top: 50%; left: 50%; margin-top: -300px; margin-left: -450px; } .wrapper { width: 33.3%; height: 100%; float: left; } #div1, #div2, #div3 { height: 200px; width: 200px; float: left; position: relative; top: 50%; left: 50%; margin-top: -135px; margin-left: -135px; border: 1px solid #808080; background-image: url(../img/a.png); background-repeat: no-repeat; padding: 35px; } #div1 { background-origin: padding-box; }
<!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
"main"
"wrapper"
id
"div1"
I was dreaming about Hawaii. I was dreaming about my holiday. In
my dream, I was on the beach in Hawaii. The hot sun was shining on
my face. The sound of the sea was all around me.
"div2"
"div3"
/*JavaScript*/
document.getElementById("div2").style.backgroundOrigin = "border-box";
/*jQuery*/
$(document).ready(function () {
$("#div3").css({ "background-origin": "content-box" });
});