如何显示< div>内嵌文字? [英] How to display <div> inline surrounded with text?

查看:120
本文介绍了如何显示< div>内嵌文字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想内嵌显示< div> 元素,使其被文本包围。

I would like to display a <div> element inline so that it is surrounded with text.

我的代码是:

<span>Here is some <div class="a"></div> text</span>

比方说,类 a 定义如下:

.a {
    width:20px;
    height:20px;
    background-color:#f00;
}

结果应如下所示:

是可行吗?谢谢您的任何建议。

Is it doable? Thank you for any suggestions.

推荐答案

有一个CSS属性 display:inline-block; ,但我不知道它与浏览器的兼容性如何(在我的FF中可以正常工作)

There's a CSS property display: inline-block; but I don't know how compatible with browsers it is (works fine in my FF)

我会为您做一些快速测试。

更新

我已经在Chrome中对其进行了测试,FF和IE。
在IE8中工作,而不是IE7。 Chrome很好,FF也很好

I've tested it in Chrome, FF and IE. Works in IE8, not IE7. Chrome is fine as is FF

这篇关于如何显示&lt; div&gt;内嵌文字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆