首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >闪亮的splitLayout不包装HTML文本

闪亮的splitLayout不包装HTML文本
EN

Stack Overflow用户
提问于 2016-12-13 07:56:13
回答 2查看 1.1K关注 0票数 5

我在一个闪亮的R应用程序中使用splitLayout来创建一个两个面板的结构,左边有一个图(一个googleVis gVisGeoChart对象),右边是HTML.

这是一个有问题的代码的模型:

代码语言:javascript
复制
splitLayout(

    htmlOutput("mychart"), #This winds up rendering properly to the left side of the window

    div(
        h1("A descriptive heading"),
        p("Here's some text that takes more than one line on the screen. I want it to wrap, but it just keeps going to the right out of view in its container.")      
    ) #This text will not wrap to the right side of the splitLayout frame
)

p()命令中的文本不会换行到splitLayout创建的页面的可见部分(1/2)。相反,它一直转到(不可见的)右侧,需要用户滚动才能看到所有内容。这不是想要的行为(坦率地说,我很难想象它会是什么情况)。

如何确保文本正确换行到splitLayout区域?

EN

回答 2

Stack Overflow用户

发布于 2018-06-01 04:12:18

太老了,但是我已经在这个问题上卡住了一段时间,之前的答案不起作用。多亏了一些html检查,我终于找到了答案。您需要为splitLayout添加一个样式元素,即:‘空白: normal',(对于splitLayout,它默认设置为’空白: nowrap‘)。见下文,在原始问题的上下文中使用。

代码语言:javascript
复制
splitLayout(

htmlOutput("mychart"), #This winds up rendering properly to the left side of the window

div(
    h1("A descriptive heading"),
    p("Here's some text that takes more than one line on the screen. I want it to wrap, but it just keeps going to the right out of view in its container.")      
),
cellArgs = list(style='white-space: normal;')
)
票数 9
EN

Stack Overflow用户

发布于 2017-12-06 03:56:04

添加style = "word-wrap: break-word;"

代码语言:javascript
复制
p("Here's some text that takes more than one line on the screen. I want it to wrap, but it just keeps going to the right out of view in its container.",
   style = "word-wrap: break-word;")
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41111636

复制
相关文章

相似问题

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