Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html css-背景图像而不是图标字体_Html_Css_Button_Pseudo Element - Fatal编程技术网

Html css-背景图像而不是图标字体

Html css-背景图像而不是图标字体,html,css,button,pseudo-element,Html,Css,Button,Pseudo Element,现在我的按钮使用图标字体。我想删除图标字体,改用图像 这就是我的代码的样子 .zocial::before { content: ""; /* some code goes here */ } .zocial.plus::before { content: "p"; } 我创建了一个JSFIDLE来向您展示演示 如您所见,该按钮现在具有图标字体(即p)和搜索图标 现在我想删除这个“p”字符,并将搜索图标移到那里 我将非常感谢你的帮助 谢谢这只是我在列表中使用的示例。 尝试以下方法,以适合您的解

现在我的按钮使用图标字体。我想删除图标字体,改用图像

这就是我的代码的样子

.zocial::before {
content: "";
/* some code goes here */
}
.zocial.plus::before {
content: "p";
}
我创建了一个JSFIDLE来向您展示演示

如您所见,该按钮现在具有图标字体(即p)和搜索图标

现在我想删除这个“p”字符,并将搜索图标移到那里

我将非常感谢你的帮助


谢谢

这只是我在列表中使用的示例。 尝试以下方法,以适合您的解决方案:

<div class="Info">
    <ul>
    <li>Text here</li>
    <li>Text here</li>
    <li>Text here</li>
    <li>Text here</li>
    </ul>
</div>

.Info ul li
{
padding-bottom:10px;
list-style-type:none; /* Switch the list bullet off altogether. */
background-image:url("images/yourImage.png"); /* The replacement bullet image */
background-position:0px 2px; /* Place bullet 0px from left and 4px from top */
background-repeat:no-repeat; /* Stops bullet tiling, important */
padding-left:22px; /* separation from li txt and bullet */

}

  • 此处文本
  • 此处文本
  • 此处文本
  • 此处文本
.Info ul li { 垫底:10px; 列表样式类型:无;/*完全关闭列表项目符号*/ 背景图像:url(“images/yourmage.png”);/*替换项目符号图像*/ 背景位置:0px 2px;/*从左侧放置项目符号0px,从顶部放置项目符号4px*/ 背景重复:无重复;/*停止项目符号平铺,重要提示*/ 左侧填充:22px;/*与li txt和bullet分离*/ }
只是我在列表中使用的示例。 尝试以下方法,以适合您的解决方案:

<div class="Info">
    <ul>
    <li>Text here</li>
    <li>Text here</li>
    <li>Text here</li>
    <li>Text here</li>
    </ul>
</div>

.Info ul li
{
padding-bottom:10px;
list-style-type:none; /* Switch the list bullet off altogether. */
background-image:url("images/yourImage.png"); /* The replacement bullet image */
background-position:0px 2px; /* Place bullet 0px from left and 4px from top */
background-repeat:no-repeat; /* Stops bullet tiling, important */
padding-left:22px; /* separation from li txt and bullet */

}

  • 此处文本
  • 此处文本
  • 此处文本
  • 此处文本
.Info ul li { 垫底:10px; 列表样式类型:无;/*完全关闭列表项目符号*/ 背景图像:url(“images/yourmage.png”);/*替换项目符号图像*/ 背景位置:0px 2px;/*从左侧放置项目符号0px,从顶部放置项目符号4px*/ 背景重复:无重复;/*停止项目符号平铺,重要提示*/ 左侧填充:22px;/*与li txt和bullet分离*/ }
您可以使用以下内容:

content: url("url/to/image.png");
或者像处理元素一样,在选择器前面的
:中创建背景

.zocial.plus::before {
    background-image: url("url/to/image.png");
}

您可以使用以下内容:

content: url("url/to/image.png");
或者像处理元素一样,在选择器前面的
:中创建背景

.zocial.plus::before {
    background-image: url("url/to/image.png");
}
试试看

.zocial.plus::before {
    content: "\0000a0";
    background: url("http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings-white.png") -48px 8px no-repeat;
}
这是小提琴: 试试看

.zocial.plus::before {
    content: "\0000a0";
    background: url("http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings-white.png") -48px 8px no-repeat;
}
这是小提琴: 而不是

content:"p"
你可以用

content: url("http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings-white.png");
当然是正确的图像

代替

content:"p"
你可以用

content: url("http://twitter.github.com/bootstrap/assets/img/glyphicons-halflings-white.png");
当然是正确的图像

问候