开发者

Why isn't the border prop working?

JsFiddle DEMO

Here's my html:

<span> Testing
    <table>
        <tbody>
            <tr>
                <td>One</td>
                &开发者_运维知识库lt;td>Two</td>
                <td>Three</td>
            </tr>
        </tbody>
    </table>
</span>

And my css:

span {
    border: 1px solid black;
}

Shouldn't the whole span get a normal border? I'm getting a messed up result in Firefox and Chrome (didn't test in others yet)

Am I missing something or doing something wrong?


<table>s don't belong in <span>s, as <table>s are block-level elements and <span>s are inline elements, so there's no point testing that code as results will be unpredictable.

Use a <div> instead of a <span>.


span {
    border: 1px solid black;
    display: block;
}


The <span> tag is used to group inline-elements in a document. The best solution would be to modify the <span> and use a <div> instead. A simple modification to reach your desired result.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜