首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >R标记柔性仪表板文本边距

R标记柔性仪表板文本边距
EN

Stack Overflow用户
提问于 2018-04-16 14:16:48
回答 1查看 1.3K关注 0票数 1

如何才能在折叠式柔性仪表板文档中为文本创建良好的页边距?他们的人工站点是使用柔性仪表板创建的,文本很好地跨越了中间的一个可读区域,并且没有到达屏幕的两侧。边距很好地调整到浏览器窗口的宽度。尽管多次尝试指定{data-width}{data-padding},但我仍然无法再现这种行为。我的文本总是从一边到另一边,在一个很宽的浏览器窗口中看起来不太好。示例Rmd文件:

代码语言:javascript
复制
---
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.
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-04-16 15:06:27

通过使用CSS对文档进行样式化。在这里,我们缩小了整个文件的篇幅。

代码语言:javascript
复制
---
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如下

代码语言:javascript
复制
<div id="myText">
....
</div>

并修改它

代码语言:javascript
复制
<style>
#myText {
  width: 300px;
  margin: auto;
}
</style>
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49859526

复制
相关文章

相似问题

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