如何才能在折叠式柔性仪表板文档中为文本创建良好的页边距?他们的人工站点是使用柔性仪表板创建的,文本很好地跨越了中间的一个可读区域,并且没有到达屏幕的两侧。边距很好地调整到浏览器窗口的宽度。尽管多次尝试指定{data-width}和{data-padding},但我仍然无法再现这种行为。我的文本总是从一边到另一边,在一个很宽的浏览器窗口中看起来不太好。示例Rmd文件:
---
title: "Text width problem"
output:
flexdashboard::flex_dashboard:
orientation: rows
---
I'd like this text to have margins on the sides. I'd like this text to have
margins on the sides. I'd like this text to have margins on the sides. I'd
like this text to have margins on the sides. I'd like this text to have
margins on the sides. I'd like this text to have margins on the sides. I'd
like this text to have margins on the sides. I'd like this text to have
margins on the sides. I'd like this text to have margins on the sides. I'd
like this text to have margins on the sides. I'd like this text to have
margins on the sides. I'd like this text to have margins on the sides. I'd
like this text to have margins on the sides. I'd like this text to have
margins on the sides.发布于 2018-04-16 15:06:27
通过使用CSS对文档进行样式化。在这里,我们缩小了整个文件的篇幅。
---
title: "Text width problem"
output:
flexdashboard::flex_dashboard:
orientation: rows
---
<style>
body {
padding: 0px 200px 0px 200px;
}
</style>
This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides. This text has margins on the sides.

另一种方法是在文本周围包装一个div容器,其ID如下
<div id="myText">
....
</div>并修改它
<style>
#myText {
width: 300px;
margin: auto;
}
</style>https://stackoverflow.com/questions/49859526
复制相似问题