Css 图像周围的空白
无法理解我是如何在图像周围获得额外的空白的: 标记:Css 图像周围的空白,css,Css,无法理解我是如何在图像周围获得额外的空白的: 标记: <div id="member-name" hidden="true"> <button type="submit" id="btnExpandSection"><img src="~/Content/Images/plus.jpg" /></button><p id="member-fullName"></p>
<div id="member-name" hidden="true">
<button type="submit" id="btnExpandSection"><img src="~/Content/Images/plus.jpg" /></button><p id="member-fullName"></p>
</div>
input, textarea
{
border: 1px solid #e2e2e2;
background: #fff;
color: #333;
font-size: .9em;
margin: 5px 0 6px 0;
padding: 5px 2px 5px 5px;
width: 300px;
}
img
{
display: block; /* gets rid off any unexpected margins round the image */
border: 0px;
}
input[type="submit"], input[type="button"], button
{
background-color: #ffffff;
cursor: pointer;
font-size: 11px;
font-weight: 600;
width: auto;
vertical-align: middle;
border: 0px;
}
td input[type="submit"], td input[type="button"], td button { font-size: 1em; }
更新:
这里也有这种风格:
#member-name
{
margin: 30px 0px 0px 0px;
height: 30px;
font-weight: bold;
color: white;
padding: 1px 1px 0px 1px;
background-color: #d28105;
border: 1px solid darkgray;
}
#member-fullName { margin: 0px 0px 0px 20px;}
#member-fullName p{ display: inline;float: left;overflow: hidden;}
你不能只提供图像作为按钮元素的背景吗
#btnExpandSection {
background: #ffffff url('/Content/Images/plus.jpg') no-repeat center center;
height: /* image height */;
width: /* image width */;
}
我会从这个开始,然后从这里重新构建它
按钮,
#成员全名,
#成员姓名,
#btnExpandSection,
#btnExpandSection img{
保证金:0;
填充:0;
}
但是下面的内容绝对适合嵌套在
标记之间的图像。用图像的实际宽度和高度值替换32px
按钮{
背景图片:url(~/Content/Images/plus.jpg);
宽度:32px;
高度:32px;
}
不,它不是实时的,我也不能将它暴露在网络上。填充导致了空白。而#成员名
和#成员全名
的CSS样式在哪里?@sparky,检查更新,我现在添加了这些样式,这样你就可以看到这些样式了。我修复了它,并将很快用我的答案更新它。我将标记更改为,然后将我的样式更改为#btnExpandSection按钮{背景图像:url(~/Content/Images/plus.jpg);宽度:21px;高度:18px;}现在我甚至看不到图像,我在第二个中注入的人的名字周围都是白色的…@CoffeeAddict,首先我的代码不是要替换你所有的CSS;它是对你现有CSS的补充。其次,你能为这个问题设置一个JSFIDLE演示吗?但是你的代码会全面使用它…我不想这样做如果是这样的话,那么就使用css上的按钮ID。更新我的代码。