Javascript 使用html/js的多配置文件css属性值
这是我的html结构实现的一个圆圈样式(还有一些其他效果)的用户配置文件。如果是静态的,很容易,只需在.img中设置背景Javascript 使用html/js的多配置文件css属性值,javascript,jquery,css,Javascript,Jquery,Css,这是我的html结构实现的一个圆圈样式(还有一些其他效果)的用户配置文件。如果是静态的,很容易,只需在.img中设置背景 但是我在做一个多用户的社交网络,jst想知道只替换背景属性并继续使用其他属性(例如我的案例,img类)是否正确。使用边界半径你可以用背景图像属性来塑造它,然后根据需要调整宽度和高度,您甚至可以使用背景尺寸:cover来保持圆圈对图像大小的响应 <div class="holder"> <div class="img"> </div><
但是我在做一个多用户的社交网络,jst想知道只替换背景属性并继续使用其他属性(例如我的案例,img类)是否正确。使用
边界半径
你可以用背景图像
属性来塑造它,然后根据需要调整宽度和高度,您甚至可以使用背景尺寸:cover
来保持圆圈对图像大小的响应
<div class="holder">
<div class="img">
</div></div>
.剖面圆{
宽度:50px;
高度:50px;
浮动:左;
位置:相对位置;
边界半径:50%;
盒影:0px 0px 10px#777;
背景图片:url('yourimage-50x50.png');
背景位置:-8px-4px;
边框:2倍纯白;
}
:
如果您想随着时间的推移对其进行更改,则只需按您所述替换背景图像
属性。,HTML
<div class="profile-circle"></div>
<style>
.profile-circle {
width: 50px;
height: 50px;
float: left;
position: relative;
border-radius: 50%;
box-shadow: 0px 0px 10px #777;
background-image: url('yourimage-50x50.png');
background-position: -8px -4px;
border: 2px solid white;
}
</stlye>
这将向这两种类型的div
添加共享属性,但仅向派生的div
添加特定属性
<div class="base">
<div class"inherited">
</div>
</div>
.base, .inherited{
margin-top:3px;
margin-left:auto;
margin-right:auto;
margin-bottom:0px;
}
.inherited{
background-image:url("images/123.jpg");
background-repeat:no-repeat;
width:950px;
height:572px;
}