闪亮 - 更改较小的下拉菜单(选择标签)的大小(填充?) [英] Shiny - change the size (padding?) of dropdown menu (select tags) smaller

查看:133
本文介绍了闪亮 - 更改较小的下拉菜单(选择标签)的大小(填充?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改较小的下拉菜单(选择标记)的大小?我认为这是填充,使下拉看起来'厚'。所以我改变填充为0,使其瘦,显然这是行不通的,

$ $ p $ shinyUI(fluidPage(

sidebarPanel(

#更改字体大小
标签$ style(type ='text / css',.selectize -input,.selectize-dropdown {padding :0;}),

#物种/污染物选项
selectInput(
inputId =species,
label =Species:,
选项= c(...)
),
....



<结果很尴尬,

在这里>



任何想法? 为解析方案

,你需要的是 line-height (默认情况下,填充已经为0,使用chrome调试器查看CSS)。



对于盒子本身,它看起来像bootstrap将放置一个 min-height 在它上面,所以你还需要添加 min-height:0; 。再次,我只是通过查看其CSS来发现调试器。



所以这里有一个可行的解决方案:

  runApp(shinyApp(
ui = fluidPage(
tags $ style(type ='text / css',.selectize-input {padding:2px ; min-height:0;} .selectize-dropdown {line-height:10px;}),
selectInput(test,Test,1:5)
),
服务器=函数(输入,输出,会话){
}
))



<请尝试发布完整的代码示例,而不是我们必须完成的代码片段。使我们能够更轻松,更快速地尝试回答

How can I change the size of dropdown menu (select tags) smaller? I thought it is the padding that makes the dropdown looking 'thick'. So I change the padding to 0 to make it 'thin' and obviously that does not work,

shinyUI(fluidPage(

  sidebarPanel(

    # Change the font size.
    tags$style(type='text/css', " .selectize-input, .selectize-dropdown { padding:0 ; }"),

    # Species/ pollutant options
    selectInput(
        inputId = "species",
        label = "Species:",
        choices = c(...)
        ),
   ....

The result is quite awkward,

Any ideas?

解决方案

For the dropdown options, it's line-height that you want (the padding is already 0 by default I think, look at the CSS on it using the chrome debugger).

For the box itself, it looks like bootstrap is placing a min-height on it, so you also need to add min-height: 0;. Again, I just figured this out right now with the debugger by looking at its CSS.

So here's a working solution:

runApp(shinyApp(
  ui = fluidPage(
    tags$style(type='text/css', ".selectize-input { padding: 2px; min-height: 0;} .selectize-dropdown { line-height: 10px; }"),
    selectInput("test","Test", 1:5)
  ),
  server = function(input, output, session) {
  }
))

Please try to post complete code samples rather than a snippet of code that we have to complete ourselves. Makes it easier and faster for us to try to answer

这篇关于闪亮 - 更改较小的下拉菜单(选择标签)的大小(填充?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆