开发者

Problem with CSS property display: inline-block

In quirks mode (IE) the following code will function correctly. In standards compliant mode, this code will only show the text of the nested span, but it will not be given 100% for width. Is there a way to force the nested inline-block span to set its width to the div size, and if so开发者_JS百科 is there a way to do it without changing the html code? Thanks for any help.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<head>
    <style>
        span {display:inline-block;}
    </style>
<head>
<body>
    <div>
        <span>
            <span style='width:100%; text-align:center;'>
                Blah
            </span>
        </span>
    </div>
</body>


The parent (span) don't have any width. Just set it and you resolve your problem

div span { width:100% }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜