开发者

Why isn't the border prop working?

开发者 https://www.devze.com 2023-03-26 10:26 出处:网络
JsFiddle DEMO Here\'s my html: <span> Testing <table> <tbody> <tr> <td>One</td>

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

精彩评论

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