html - CSS border-image 基础知识

标签 html css border

这真的很简单,但我不明白问题是什么。

在 ASP.Net 网页中,我想创建一个带有特定边框的 div。

CSS:

.ResourcesDiv
{
border-image:url(http://blogrope.com/wp-content/uploads/2013/06/003-wood-melamine-subttle-pattern-background-pat.jpg) 30 30 stretch;
border: 15px solid transperant;
width: 300px;
padding: 10px 20px;
margin: 50px;
}

HTML/ASP:

<div id="Resources" class="ResourcesDiv">
In the future, this will display the amount of herbs the user has.<br />
In the future, this will display the amount of gems the user has.<br />
</div>

编辑:如果我删除边框的 transperant 部分而不是图像,它会显示黑色边框,尽管我很确定 url 设置正确。

最佳答案

参见 fiddle

我已经按如下方式更改了您的 CSS

CSS

.ResourcesDiv {
    border-image:url("http://blogrope.com/wp-content/uploads/2013/06/003-wood-melamine-subttle-pattern-background-pat.jpg") 30 30 stretch;
    border: 15px solid url("http://blogrope.com/wp-content/uploads/2013/06/003-wood-melamine-subttle-pattern-background-pat.jpg") 30 30 stretch;
    width: 300px;
    padding: 10px 20px;
    margin: 50px;
}

试一试..

更新

检查 fiddle --在 chrome 和 firefox 中测试

关于html - CSS border-image 基础知识,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29058236/

相关文章:

html - ExtJS4 - 如何将 Ext.form.Basic 转换为 HTMLFormElement

html - 当前一个 div 文本溢出时,内联 div 行的第二个 div 从下一行开始而不是在前一个 div 之后

javascript - 更改组 radio 输入的背景颜色

html - 使 Angular Routing 正常工作时遇到问题

css - Fieldset 奇怪的图例下划线问题

css - Firefox 4 中的粉色边框

jquery - 替换图像而不是文本不起作用

html - 正则表达式匹配逗号之前但不之后的空格

JQuery - 从元素中保存 html 并恢复它

css - 为什么元素和它的边框之间有空格?