Easy steps for aligning text with shiny html

Looking at the code below, I was able to successfully align the bullet-point text in the popover when hovering over the information circle. However, I am still struggling to justify-align its header right above it, as seen in this image. When I remove the ul from the line

tags$style('.popover ul {padding: 15px; text-align: justify;}')
, everything is justified but other desired formatting is lost. How can I modify this code to also cleanly justify that header paragraph?

https://i.stack.imgur.com/DMk19.png

Here's the code snippet:

library(shiny)
library(shinyBS)

ui <- fluidPage(
  tags$style('.popover ul {padding: 15px; text-align: justify;}'),
  br(),
  uiOutput("uiExample")
)
    
server <- function(input, output, session) {
  output$uiExample <- renderUI({
    tagList(
      tags$span("Little circle >>"),
      tags$span(
        popify(
          icon("info-circle", verify_fa = FALSE),
          "Placeholder",
          paste(
           "Here is an excerpt from a famous poem Still I Rise:",
           "<ul>",
             "<li>You may write me down in history With your bitter, twisted lies,</li>",
             "<li>You may tread me in the very dirt. But still, like dust, I will rise.",
             "Does my sassiness upset you...</li>",
           "</ul>"
           )
        )
      )  
    )
  })
}

shinyApp(ui, server)

Answer №1

If you want to align text in your popover content, you can use the following CSS code:

'.popover-content {text-align: justify;}'
library(shiny)
library(shinyBS)

ui <- fluidPage(
  tags$style('.popover ul {padding: 15px; text-align: justify;}',
             '.popover-content {text-align: justify;}'),
  br(),
  uiOutput("uiExample")
)

server <- function(input, output, session) {
  output$uiExample <- renderUI({
    tagList(
      tags$span("Little circle >>"),
      tags$span(
        popify(
          icon("info-circle", verify_fa = FALSE),
          "Placeholder",
          paste(
            "Here is an excerpt from a famous poem Still I Rise:",
            "<ul>",
            "<li>You may write me down in history With your bitter, twisted lies,</li>",
            "<li>You may tread me in the very dirt. But still, like dust, I will rise.",
            "Does my sassiness upset you...</li>",
            "</ul>"
          )
        )
      )  
    )
  })
}

shinyApp(ui, server)

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Extracting data from Sreality.cz website

After attempting to scrape data from a real estate website and organize it in a manner that allows for easy filtering and analysis using a spreadsheet, I find myself stuck on moving forward with the R code. It's somewhat embarrassing to admit, but I a ...

Background image that covers the entire screen, div elements that scroll on top of the landing screen initially

As a beginner in the world of coding, I apologize for any simple errors in my attempt. Despite researching this issue, I have not been able to find a precise solution that fits my needs. My goal is to create a full-screen background for the landing page. ...

Experiencing an unexpected wait before the requestAnimationFrame?

Surprisingly, Internet Explorer is actually performing the way I want it to in this case :-) I developed a function for SVG animations using requestAnimationFrame (for simplicity, I left out the value calculations here ... but my initial test involved an ...

Personalize the drop area in Filepond

Is there a way to customize the filepond droparea by adding custom HTML with placeholder images to guide users on what kind of images should be uploaded and allow multiple uploads? I attempted to add placeholders in an absolutely positioned container, but ...

Responsive Input Navigation Bar CSS

How can I create a top bar that resembles the design of Google Play? I am struggling to make the input box flexible and fit the window size... The minimum width of Div.search is set to 250px but it's not working. Can someone help? *{ box-sizing: ...

Is it possible to toggle all parent targets in Bootstrap?

When trying to showcase my point, I believe it is best demonstrated by visiting Bootstrap documentation at https://getbootstrap.com/docs/4.0/components/collapse/ and viewing the "multiple targets section." In this section, you will find three buttons: togg ...

Are desktop values taking precedence over the mobile media query?

Currently, I am facing an issue with aligning icons (images) under each title on a page that lists various classes. The icon needs to be centered below the title on both desktop and mobile versions of the site. However, I have encountered a problem where u ...

The breakdown of an object literal in JavaScript

What is the reason that we cannot access the second item in the object literal the same way as the first? var foo = {a:"alpha",2:"beta"}; console.log(foo.a) -> printing 'alpha' correctly console.log(foo.2) -> Error: missing ) after argumen ...

Guide to Setting the Color of a Link Using CSS

I’ve been attempting to change the color of an ALink using CSS, but it seems like I just can’t get it right. It’s clear that I’m missing something, as I’ve spent quite a bit of time tinkering with this seemingly simple issue and still can’t fi ...

Several HTML dropdown menus that do not expand

On my website, I have several select elements but the first one related to math is giving me trouble. It doesn't expand properly - sometimes it works on the first click but stops working afterwards. I've tested this issue on both Google Chrome a ...

Swap File Field for Picture Graphic - HTML/CSS

I am looking to enhance the appearance of my form by replacing the generic File Field with a more aesthetically pleasing Image Icon. If you click on this Camera Icon, it will open up a Browse window: For a demonstration, check out this JsFiddle link: htt ...

Navigate to items within a content block with a set height

I have a <div> that has a fixed height and overflow-y: scroll. Inside this div, there is mostly a <p> tag containing a long text with some highlighting (spans with background-color and a numbered id attribute). Just to note, this is an HTML5 a ...

Retrieving the chosen option from a dropdown menu using AngularJS

<tr (click)="onRowClick(myDropDownList.value)"> <td> <select #myDropDownList (click)="$event.stopPropagation()" (change)="onChange($event.target.value)"> <option *ngFor="let n of numbers" [value]="n">{{n}}</option> </se ...

When viewing the material-ui Chip component at normal zoom, a border outlines the element, but this border disappears when zoomed in or out, regardless of

Edit I have recently discovered a solution to the unusual problem I was facing with the material-ui Chip Component. By adding the line -webkit-appearance: none; to the root div for the Chip, the issue seems to resolve itself. However, this line is being a ...

Guide to extracting HTML content from an AJAX call?

I am currently attempting to extract a value from an HTML form. This involves making a GET request to a specific URL, retrieving the HTML content, and then utilizing jQuery to parse through it. Below is the snippet of HTML that I need to navigate through: ...

Applying a classification label to data output in R

I'm currently in the process of computing the proportion of observed counts for a Pearson's chi-square test. Within my dataset, there is a column dedicated to categories ("x") and another column for frequencies ("freq"). My plan is to divide the ...

Instructions for capturing multi-dimensional arrays using forms in Vue

I have a snippet of code that looks like this: <div class="form-item"> <label for="list-0"><?php _e('List 0', 'test'); ?></label> <input name="list[0]" type="text" id="list-0" value=""> </div> &l ...

flask - Transfer data from Python to HTML using a database

I have written code to fetch data from a database and now I want to display it in an HTML format. Below is the code snippet from app.py @app.route('/news') def news(): import pymysql import re host='localhost' user = ...

Using jQuery's toggleClass method to implement CSS transformations

I have a question about this situation Each time the button is clicked, jQuery toggles the class: .transition { background-color: #CBA; transform: translateX(100px) scale(0.5) rotate(180deg); } Within the <div class="container2"> And upon ...

Guide to Displaying Items in Order, Concealing Them, and Looping in jQuery

I am trying to create a unique animation where three lines of text appear in succession, then hide, and then reappear in succession. I have successfully split the lines into span tags to make them appear one after the other. However, I am struggling to fin ...