是否可以在闪亮的 ui FluidPage 中将三个图像排成一行居中,并将每个图像的宽度固定为 300px?要得到:
我的一个想法是使用 splitLayout 并以某种方式插入图像作为窗口宽度的函数,但我不确定如何实现这一点。我知道您可以使用 splitLayout 将图像设置为窗口的百分比,但我特别希望中间图像为 300px。
fluidPage(fluidRow(
splitLayout(cellWidths = c("34%", 300, "34%"), cellArgs = list(style = "padding: 0px"), style = "border: 0px; padding: 0px;",
div(img(src="image1", height=300, width=300, align="right"),
div(img(src="image2", height=300, width=300, align="center"),
div(img(src="image3", height=300, width=300, align="left")), ...
所以问题是我得到的图像偏离中心:
但是当我将中间单元格设置为 33% 时,图像之间的间隙太大了。
splitLayout(cellWidths = c("34%", "33%", "34%"), cellArgs = list(style = "padding: 0px"), style = "border: 0px; padding: 0px;",
div(img(src="image1", height=300, width=300, align="right"),
div(img(src="image2", height=300, width=300, align="center"),
div(img(src="image3", height=300, width=300, align="left"))
所以我追求的是cellWidths = c((windowWidth-300)/2, 300, (windowWidth-300)/2)
但我不知道如何提取 windowWidth。