首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何确保可折叠表格后面的文本显示在其下方,而不是右侧?

问如何确保可折叠表格后面的文本显示在其下方,而不是右侧?
EN

Stack Overflow用户
提问于 2019-01-26 08:13:37
回答 1查看 81关注 0票数 0

左对齐、缩小(宽度:70%)折叠表格后面的文本显示在表格的右侧。我不能让它移动到它下面。

我尝试过将<br/>放在折叠表格的后面和里面(很明显,这只是在单元格中放了一个分隔符)。删除左对齐可以修复此问题,但会创建另一个将表格边缘缩小到最小高度的问题。

下面是用MediaWiki的语法编写的代码(因此使用大括号和管道)。它仍然使用HTML和CSS,只是格式略有不同:

代码语言:javascript
复制
{| class="mw-collapsible mw-collapsed" align="left" style="display:inline; width:70%; text-align:left; background:#f9f9f9; border:1px #0a0a0a solid; border-radius: 10px;"
! Header text here. Just after it to the right goes the button.
|-
| Body content goes here. Intended to be a long list of items, only using the one cell.
It could be paragraphs. Maybe it's a poem.
It uses multiple lines to say what it needs to say.

Table width narrowed to 70% to make the problem obvious, btw. Actual value will be 95%.
|}
<br/>

This paragraph comes after the collapsible table.

我希望的结果是,从一开始,表格标题就会显示一个用于展开表格的按钮。在表格下面有一个段落,当它展开时,它会停留在表格下方。

取而代之的是,下面的段落从紧邻缩小的表格的右侧开始。在表代码后面添加任何换行<br/>都不会做任何事情,只会将段落下移一行。(假设换行符也在表格的右侧结束。)

EN

回答 1

Stack Overflow用户

发布于 2019-01-28 09:56:58

之后添加<div style="clear:both">可以解决此问题:

代码语言:javascript
复制
{| class="mw-collapsible mw-collapsed" align="left" style="display:inline; width:70%; text-align:left; background:#f9f9f9; border:1px #0a0a0a solid; border-radius: 10px;"
! Header text here. Just after it to the right goes the button.
|-
| Body content goes here. Intended to be a long list of items, only using the one cell.
It could be paragraphs. Maybe it's a poem.
It uses multiple lines to say what it needs to say.

Table width narrowed to 70% to make the problem obvious, btw. Actual value will be 95%.
|}

<div style="clear:both"></div>

This paragraph comes after the collapsible table.

段落也可以在<div>中

代码语言:javascript
复制
{| class="mw-collapsible mw-collapsed" align="left" style="display:inline; width:70%; text-align:left; background:#f9f9f9; border:1px #0a0a0a solid; border-radius: 10px;"
! Header text here. Just after it to the right goes the button.
|-
| Body content goes here. Intended to be a long list of items, only using the one cell.
It could be paragraphs. Maybe it's a poem.
It uses multiple lines to say what it needs to say.

Table width narrowed to 70% to make the problem obvious, btw. Actual value will be 95%.
|}

<div style="clear:both">
This paragraph comes after the collapsible table.
</div>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54374460

复制
相关文章

相似问题

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