我有一个使用大量背景图片的 Reveal.js 幻灯片:
<section data-background="latimes.png">
<small class="caption">[Some Text](http://a.link.com/whatever)</small>
<aside class="notes">some notes</aside>
</section>
Run Code Online (Sandbox Code Playgroud)
我想在每张幻灯片的左下角为每张图片添加一个标题/链接。
我尝试设置自定义类
.reveal .caption a {
background: #FFF;
color: #666;
padding: 10px;
border: 1px dashed #999;
}
.reveal .caption {
postion: absolute;
bottom: 0px;
left: 50px;
}
Run Code Online (Sandbox Code Playgroud)
但它似乎对布局没有任何影响。元素检查器似乎不能很好地与 Reveal.js 配合使用,这使得很难对其进行故障排除。在reveal.js中是否有一种将文本块强制到屏幕一角的好方法?
这可能有点棘手的原因是因为父节点有一些设置的默认值。
在初始化时将宽度和高度设置为 100% Reveal:
Reveal.initialize({
width: "100%",
height:"100%"
});
Run Code Online (Sandbox Code Playgroud)
确保幻灯片(即section)使用整个空间:
.full {
height:100%;
width:100%;
}
Run Code Online (Sandbox Code Playgroud)
最后设置标题的位置:
.caption {
bottom:0px;
right:0px;
position:absolute;
}
Run Code Online (Sandbox Code Playgroud)
小智 0
你能提供一个包含该类的 HTML 示例吗.reveal?添加position:absolute到您的选择器规则。如果您希望标题与每张幻灯片的底角齐平,最好将位置设置为 ,bottom:0px而不是top。
例如:
<style type="text/css">
.reveal .reveal_section {
position: relative;
}
.reveal .caption {
position: absolute;
bottom: 0px;
left: 50px;
}
.reveal .caption a {
background: #FFF;
color: #666;
padding: 10px;
border: 1px dashed #999;
}
</style>
<div class="reveal">
<section class="reveal_section" data-background="latimes.png">
<small class="caption">[Some Text](http://a.link.com/whatever)</small>
<aside class="notes">some notes</aside>
</section>
</div>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3269 次 |
| 最近记录: |