代码之家  ›  专栏  ›  技术社区  ›  ixodid

闪亮的列格式问题

  •  1
  • ixodid  · 技术社区  · 7 年前

    我试图将actionButton与textInput字段水平对齐。

    因为“next_question”actionButton和“correct”textInput字段在同一个fluidRow中,我认为它们应该水平对齐。他们不是。

    我错过了什么?

    library(shiny)
    
    shinyApp(
      ui = fluidPage(
    
        sidebarLayout(
          sidebarPanel(
    
            textInput("answer", width = "50px", label = "Answer"),
    
            fluidRow(  
              column(2, actionButton(inputId = "next_question", label = "Next")),
              column(8, textInput(inputId = "correct", width = 30, label = "yup"))
            )
          ),
    
          mainPanel(
            # Equation
            textOutput("equation")
          ))),
    
      server = function(input, output, session){}
    )
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   amrrs    7 年前

    解决方案是在 display:inline-block .

    library(shiny)
    
    shinyApp(
      ui = fluidPage(
    
        sidebarLayout(
          sidebarPanel(
    
            textInput("answer", width = "50px", label = "Answer"),
    
            fluidRow(  
    
    
                     actionButton(inputId = "next_question", label = "Next"),
                     tags$div(textInput(inputId = "correct", label = "yup"), style = "display:inline-block")
    
            )
          ),
    
          mainPanel(
            # Equation
            textOutput("equation")
          ))),
    
      server = function(input, output, session){}
    )
    

    参考文献: https://www.w3schools.com/Css/tryit.asp?filename=trycss_inline-block_nav

    推荐文章