background-color
background-position
background-size
background-repeat
background-origin
background-clip
background-attachment
background-image
background少了一个属性 ,禁止平铺 no-repeat
换行符
你的图片不是背景吧 我是这样理解的。把图片设置为背景图 ,是可行的。但是我实现的时候出现了横拉条。你可以试试,相互讨论讨论
再外面套一层div,同宽同高同边框,把 .box2的border属性删掉
background-position定位
右侧定位时 border-right:; 是对右边缘设置的
如果是对背景图片设置的,那么背景图片是有border属性的,只是透明化而已,他还存在呢。
如果是给背景图片加了div盒子,那么background-position对这个div的定位应该是起作用的吧
我的看法而已,有什么问题多多交流。
边框位置就会留出来啊,留出来的位置就是相对右边定位了
老师的代码没有,我有个自己写的你可以参考下!
<style>
body {
font: 14px/1.4286 "microsoft yahei";
}
.a{
width: 200px;
height: 100px;
background: #0066CC url(img/golo.png) no-repeat;
background-position: 40px;
}
.b{
width:200px;
height: 100px;
background: #0066CC url(img/golo.png) no-repeat;
background-position: 100% 40px;
}
</style>
</head>
<body>
<h2>background定位的局限</h2>
<div class="a"></div><br />
<div class="b"></div>
</body>
transparent就是透明的意思,boder-color对应的位置遵循上右下左原则,而red red transparent transparent就是把下的blue和左的orange去掉,就变成了一个斜三角了
这个边框感觉要用阴影区完成,要不然你右侧的边框不可能既有颜色又是透明的,
透明,就是你看不到但是它占位置