无法弄清楚我如何在图片周围获得额外的空白:



标记:

       <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 */;
}

关于css - 图片周围的空白,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13190052/

10-10 00:00