首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >hr没有覆盖图像

hr没有覆盖图像
EN

Stack Overflow用户
提问于 2017-03-16 06:02:01
回答 3查看 31关注 0票数 0

这是一个有两行的表格。第一行包含一个hr。第二个表格行包含文本和图像。为什么hr不同时覆盖图像和文本呢?

代码语言:javascript
复制
        <table>
            <tr>
                <td align="center">
                    <hr class="hr">
                </td>
            </tr>
            <tr align="center">
                <td width="60%" align="center">
                    <p>
                    Every occasion should be a special one!  No matter the event, a custom-designed cake always adds that special something. 

                    Weddings, birthdays, baby showers, an anniversary...  for ANY event, large or small, let me help you celebrate with a delicious and beautifully-designed and decorated cake!

                    Please take a look through my Cake Photo Gallery to see some of the work I've done recently.

                    Anytime Cakes!  Any cake, any style, any time!!

                    Enjoy!

                    ...Andrea
                    </p>
                </td>
                <td width="40%" align="center">
                    <img src="images/homeimg.jpg">
                </td>
            </tr>
        </table>

EN

回答 3

Stack Overflow用户

发布于 2017-03-16 06:07:16

第二行有两个单元格,第一行只有一个。将colspan="2"添加到第一个td,使其两列宽:

代码语言:javascript
复制
<table>
  <tr>
    <td align="center" colspan="2">
      <hr class="hr">
    </td>
  </tr>
  <tr align="center">
    <td width="60%" align="center">
      <p>
        Every occasion should be a special one! No matter the event, a custom-designed cake always adds that special something. Weddings, birthdays, baby showers, an anniversary... for ANY event, large or small, let me help you celebrate with a delicious and
        beautifully-designed and decorated cake! Please take a look through my Cake Photo Gallery to see some of the work I've done recently. Anytime Cakes! Any cake, any style, any time!! Enjoy! ...Andrea
      </p>
    </td>
    <td width="40%" align="center">
      <img src="images/homeimg.jpg">
    </td>
  </tr>
</table>

票数 1
EN

Stack Overflow用户

发布于 2017-03-16 06:06:47

<td colspan="2"><hr/></td>

票数 0
EN

Stack Overflow用户

发布于 2017-03-16 06:07:08

您可以使用colspan将两个cols合并为一个col。

代码语言:javascript
复制
<table>
            <tr>
                <td align="center" colspan="2">
                    <hr class="hr">
                </td>
            </tr>
            <tr align="center">
                <td width="60%" align="center">
                    <p>
                    Every occasion should be a special one!  No matter the event, a custom-designed cake always adds that special something. 

                    Weddings, birthdays, baby showers, an anniversary...  for ANY event, large or small, let me help you celebrate with a delicious and beautifully-designed and decorated cake!

                    Please take a look through my Cake Photo Gallery to see some of the work I've done recently.

                    Anytime Cakes!  Any cake, any style, any time!!

                    Enjoy!

                    ...Andrea
                    </p>
                </td>
                <td width="40%" align="center">
                    <img src="images/homeimg.jpg">
                </td>
            </tr>
        </table>

有关详细信息,请访问W3C网站:https://www.w3schools.com/tags/att_td_colspan.asp

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42821511

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档