gpt4 book ai didi

javascript - MediaWiki 如何让 [Collapse] 链接不随文本移动位置?

转载 作者:行者123 更新时间:2023-11-28 17:49:46 25 4
gpt4 key购买 nike

当您点击 [Expand] 时,[Collapse] 链接会出现,但随着文本的长度向右移动。
我不希望 [Collapse] 链接向右移动,我希望它显示为 put。

如何让 [Collapse] 链接不随文本移动位置?

{| class="mw-collapsible mw-collapsed" style="text-align:left;"<br>
! '''Header'''<br>
|-<br>
|<br>
Line1: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line2: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line3: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line4: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line5: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
|}


最佳答案

要阻止展开/折叠链接移动,您可以在表格上设置宽度,例如:

{| class="mw-collapsible mw-collapsed"
! style="width: 50em" | '''Header'''
|-
| Line1: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line2: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line3: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line4: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
Line5: A long line of text that is used to test the position of the [Collapse] link in my document.<br>
|}

(我删除了额外的 <br> 元素和 align: left)

不幸的是,由于“展开”和“折叠”之间的宽度差异,表头仍会略微移动位置。如果您想停止该移动,您可以向 Mediawiki:Common.css 添加一条语句,即 wiki 的全局样式表,以指定切换的宽度。检查源代码,切换位于类 .mw-collapsible-toggle 的元素中,因此您可以使用如下语句在 Mediawiki:Common.css 中指定宽度:

.mw-collapsible-toggle { width: 5em; }

您还可以将页眉左对齐(就像您在原始示例中所做的那样)而不是居中对齐。

关于javascript - MediaWiki 如何让 [Collapse] 链接不随文本移动位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22546710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com