簡體   English   中英

定制 CSS 在 shiny 盒子里

[英]custom CSS in shiny box

我正在嘗試創建一個box ,其中包含左上角的標題和右上角的小圖標。 HTML看起來像這樣:

<div class="box-header">
  <h3 class="box-title">TOTAL DAY</h3>
  <img class="box-title" src="https://www.gravatar.com/avatar/4ab40c688a7362255373fc5f185b9698?s=48&amp;d=identicon&amp;r=PG&amp;f=1">
</div>

具有以下css更改:

.box-header .box-title{
  width: 50%;
  float: left;
}

img{
  object-fit: contain;
  object-position: right;
  height: 2vh;
}

結果看起來像這樣:

在此處輸入圖像描述

添加css很容易,但是有沒有辦法在shiny中添加這樣的<img>

有點解決了我自己的問題..哎呀

我在box function 中使用了這個:

title = HTML("<h3 class=box-title>TOTAL DAY</h3><img class=box-title src=https://www.gravatar.com/avatar/4ab40c688a7362255373fc5f185b9698?s=48&d=identicon&r=PG&f=1></img>")

HTML包裝在HTML() function 中允許shiny讀取HTML作為代碼而不是字符

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM