Themeroller 图标没有排列在我期望的位置
我试图在页面上使用主题滚轮图标,但它没有排列在我期望的位置。如果我说:
<html>
<head>
<title>Test Page</title>
<link rel="stylesheet" type="text/css" media="screen"
href="/css/ui-lightness/jquery-ui-1.8.17.custom.css" />
</head>
<body>
<div><span class="ui-icon ui-icon-plusthick"></span>Hello World</div>
</body>
</html>
我希望看到:
+Hello World
但我只看到:
+
这是为什么?我怎样才能得到我期望的结果?
谢谢。
编辑1: 我按照下面的建议将跨度更改为两个标签(打开和关闭,如上所示),但这没有任何区别。
相关的 CSS 似乎是:
.ui-icon
{
display: block;
text-indent: -99999px;
overflow-x: hidden;
overflow-y: hidden;
background-repeat: no-repeat;
}
.ui-icon
{
width: 16px;
height: 16px;
background-image: url("images/ui-icons_222222_256x240.png");
}
.ui-icon-plusthick
{
background-position: -32px -128px;
}
我尝试将 display: block 更改为 inline-block 等,但如果我这样做,情况会变得更糟。
编辑3: 没关系,我搞砸了代码,它应该是:
<span class="ui-icon ui-icon-plusthick"
style="display: inline-block"></span>Hello World</div>
而且效果很好。 (我拼错了“显示”)
I'm trying to use a themeroller icon on a page and it's not lining up where I'd expect. If I say:
<html>
<head>
<title>Test Page</title>
<link rel="stylesheet" type="text/css" media="screen"
href="/css/ui-lightness/jquery-ui-1.8.17.custom.css" />
</head>
<body>
<div><span class="ui-icon ui-icon-plusthick"></span>Hello World</div>
</body>
</html>
I would expect to see:
+Hello World
But instead I only see:
+
Why is this? And how do I get the result I'm expecting?
Thank you.
Edit 1:
I followed the suggestion below to change the span to two tags (open and close, as shown above), but that didn't make any difference.
The relevant CSS seems to be:
.ui-icon
{
display: block;
text-indent: -99999px;
overflow-x: hidden;
overflow-y: hidden;
background-repeat: no-repeat;
}
.ui-icon
{
width: 16px;
height: 16px;
background-image: url("images/ui-icons_222222_256x240.png");
}
.ui-icon-plusthick
{
background-position: -32px -128px;
}
I tried changing the display: block to inline-block and other things, but it gets worse if I do.
Edit 3:
Nevermind, I screwed up the code, it should have been:
<span class="ui-icon ui-icon-plusthick"
style="display: inline-block"></span>Hello World</div>
And that works fine. (I misspelled "display")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
span 不能自动关闭,必须有一个
来关闭它
MDN 上的 span 元素
使用:
而不是:
spans are not self closing must have a
</span>
to close itspan element on MDN
use:
instead of:
你在哪里关闭跨度?
Where did you close the span?