延伸链接
通过CSS“拉伸”嵌套链接,使任何HTML元素或Bootstrap组件均可点击。
Add .stretched-link
链接使其 包含块 通过点击 ::after
伪元素。 在大多数情况下,这意味着具有 position: relative;
包含与 .stretched-link
该类是可点击的。
卡有 position: relative
默认情况下在Bootstrap中,因此在这种情况下,您可以安全地添加 .stretched-link
类到卡片中的链接,而没有其他任何HTML更改。
延伸链接不建议使用多个链接和点击目标。 但是,有些 position
and z-index
样式可以帮助您。
媒体对象没有 position: relative
默认情况下,因此我们需要添加 .position-relative
这里可以防止链接延伸到媒体对象外部。
具有延伸链接的媒体
Cras坐在gravida nulla的amet nibh libero。 Nulla vel metus scelerisque ante sollicitudin。 Cras purus odio,前庭在腐殖质处,tempus viverra turpis。 Fusce调味品nunc ac nisi寻常小菜鸟。 Donec lacinia在faucibus中抢夺了猫。
去一个地方列是 position: relative
默认情况下,因此可点击列仅需要 .stretched-link
链接上的类。 但是,将链接延伸到整个 .row
要求 .position-static
在列上 .position-relative
在行上。
具有拉伸链接的列
Cras坐在gravida nulla的amet nibh libero。 Nulla vel metus scelerisque ante sollicitudin。 Cras purus odio,前庭在腐殖质处,tempus viverra turpis。 Fusce调味品nunc ac nisi寻常小菜鸟。 Donec lacinia在faucibus中抢夺了猫。
去一个地方识别包含块
如果拉伸后的链接似乎无效,则 包含块 可能是原因。 以下CSS属性将使元素成为包含块:
- A
position
以外的价值static
- A
transform
orperspective
以外的价值none
- A
will-change
的价值transform
orperspective
- A
filter
以外的价值none
or awill-change
的价值filter
(仅适用于Firefox)
带有延伸链接的卡片
一些快速的示例文本可在卡片标题上构建,并构成卡片内容的大部分。
延伸链接在这里不起作用,因为 position: relative
已添加到链接
This 延伸链接 只会散布在 p
-tag,因为已对其应用了转换。