我想做的是这样的:
1 2 3 4 5
6 7
8 9 10 11
Run Code Online (Sandbox Code Playgroud)
有了这个代码:
<div style="text-align: justify;">
1 2 3 4 5
<br>
6 7
<br>
8 9 10 11
</div>
Run Code Online (Sandbox Code Playgroud)
但它不起作用,并且显示如下:
1 2 3 4 5
6 7
8 9 10 11
Run Code Online (Sandbox Code Playgroud) 我有一个由1px的高(重复无限期)使用的图像170像素宽的菜单系统,它在左边10px的边界,但右侧的边框30像素.
有没有办法使文本居中,但是在右侧占了额外的20px?
小提琴SiteCode:http://jsfiddle.net/jgallaway81/AXVT5/1/
相关守则:
.menubuttonthin {margin-left:0px; margin-top:0px; margin-bottom:0px; width:170px; height:30px; display:block; line-height:30px; font-family:courier; font-size:small; color:#C8C8C8; text-decoration:none; font-weight:900; background-image: url(../_pic-lib/lcars-frame-button-thin.png); }
<a href="http://www.fccorp.us/index.fccorp.php" class="menubuttonthin"> FCCorp.US Story </a>
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我没有div'd链接,因为它们由创建菜单区域框的div封装.此外,我已尝试边缘和填充两侧,但所有这一切都是增加teh框的大小,抛弃背景图像,使其与网站的背景图像不匹配.
是否有一种特殊的方法可以使用flexboxes(或其他纯CSS)在元素中垂直居中文本?
小提琴:http://jsfiddle.net/WK_of_Angmar/JZZWg/
<body>
<div id="main">
<section id="a">Test1</section>
<section id="b">Test2</section>
</div>
Run Code Online (Sandbox Code Playgroud)
#a {
flex: 1 0 auto;
}
#b {
flex: 0 0 auto;
min-height: 3em;
background-color: yellow;
}
#a {
background-color: blue;
}
#main {
display: flex;
flex-direction: column;
height: inherit;
}
body {height: inherit;}
html {height: 100%;}
Run Code Online (Sandbox Code Playgroud) 这是我想用CSS实现的一个可视化示例:

另请参见http://jsfiddle.net/En4yC/3/
问题是我需要在图标旁边对齐文本,但不要给它一个严格的宽度,因为容器列是液体.你认为这有可能吗?也许一些负利润可以用于浮动?
//CSS
.column {
width:33.3333%;
}
.ico {
display: inline-block;
float:left;
width: 32px;
height: 32px;
margin-top: 4px;
margin-right:10px;
line-height: 32px;
background-image: url("http://fakeimg.pl/32x32/");
background-position: 0 0;
background-repeat: no-repeat;
}
//HTML
<div class="column">
<span class="ico"></span>
<span class="title">Curabitur pharetra<br/> nibh eget<br/> lorem<br/> egestas laoreet</span>
</div>
Run Code Online (Sandbox Code Playgroud) 你如何正确地对齐杰基尔的文字?
我有一个我想要对齐的文本块.
如果它是HTML,我会做类似的事情:
style="text-align:right;"
Run Code Online (Sandbox Code Playgroud)
我怎么能在Markdown和Jekyll一起做到这一点?
我试图使用TextArea组件让用户编写多行文本,但问题是我无法将文本对齐设置为正确.默认情况下,它从左侧开始.
文本将是希伯来语或阿拉伯语,因此我需要用户从右到左书写TextArea.我没有从TextArea代码和文档中找到一种方法来做到这一点,并且在一些论坛中有些人说它无法完成.真的吗?
作为将浮点数与表格数字数据的小数分隔符对齐的解决方法,我尝试找到一个正则表达式来用空格替换(全局后验)尾随零,规则如下:
由于 Python 正则表达式引擎对需要固定宽度模式的后视的限制,我无法找到令人满意的解决方案。这是我尝试的一个工作示例(Python 3.x);不要依赖解决方案中的竖线,它们在示例中只是为了清楚起见:
import re
# formatmany is just a way to speed up building of multiline string of tabular data
formatmany=lambda f:lambda *s:'\n'.join(f.format(*x) for x in s)
my_list = [[12345, 12.345, 12.345, 12.345],
[12340, 12.34 , 12.34 , 12.34 ],
[12345, 12.005, 12.005, 12.005],
[12340, 12.04 , 12.04 , 12.04 ],
[12300, 12.3 , 12.3 , 12.3 ],
[12000, 12.0 , 12.0 , 12 ]]
my_format = formatmany('|{:8d}|{:8.2f}|{:8.3f}|{:8.4f}|')
my_string = my_format(*my_list) # this …Run Code Online (Sandbox Code Playgroud) 我目前正在向我的应用添加信息页面,并希望显示以分组UITableView的页脚为中心的应用程序的版本号.我有它显示,但我不知道如何去集中它.
我已经看过使用tableviews viewForFooterInSection; 这是未来的正确方法,还是有更简单的方法?
提前谢谢了.

我有198px-198px的方形按钮.每个按钮下面都有一个图像和文字.由于并非所有图像都是正方形,因此我将所有图像的最大宽度和最大高度设置为128px,以便它们按比例缩放.不幸的是,我无法将文本与底部中心对齐.
我无法使用padding-top: 65px哪个解决了其他一些SO问题,因为图像的高度可变.
我尝试position: absolute; top: 180px了文本的范围,但我不能让它在那之后居中(不能只指定left: 10px因为文本有可变的长度)
谢谢你的帮助.
这是一个JSFiddle https://jsfiddle.net/vbgg3keu/3/ (注意:您可以扩展输出窗格的宽度,以便所有按钮在同一行上排成一行)
HTML:
<button class="square-button">
<img class="small-img" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"/><br/>
<span class="button-text">This text is too high</span>
</button>
<button class="square-button">
<img class="small-img" src="http://etc.usf.edu/clipart/36400/36459/ruler1_36459_lg.gif"/><br/>
<span class="button-text">This text is too high</span>
</button>
<button class="square-button">
<img class="small-img" src="https://tall.life/wp-content/uploads/2013/04/Giraffe.jpg"/><br/>
<span class="button-text">This text is the correct height</span>
</button>
<button class="square-button">
<img class="small-img" src="https://lh3.googleusercontent.com/dB3Dvgf3VIglusoGJAfpNUAANhTXW8K9mvIsiIPkhJUAbAKGKJcEMPTf0mkSexzLM5o=w300"/><br/>
<span class="button-text">This text is the correct height</span>
</button>
Run Code Online (Sandbox Code Playgroud)
CSS:
.square-button {
width: 198px;
height: 198px;
float: left;
}
.small-img …Run Code Online (Sandbox Code Playgroud) 我希望我的文本在多面躲避条形图中的每个条形上方居中对齐。
# setup
library(ggplot2); library(tidyverse)
data("iris")
# graph
iris %>% group_by(Species) %>%
mutate(Petal_Group = ifelse(Petal.Width < median(Petal.Width), "Short", "Long")) %>%
mutate(Sepal_Group = ifelse(Sepal.Width < median(Sepal.Width), "Short", "Long")) %>%
group_by(Petal_Group, Sepal_Group, Species) %>%
summarise(mean.Sepal.Length = mean(Sepal.Length)) %>%
mutate(asterisks = "***") %>%
ggplot(aes(x = Petal_Group, y = mean.Sepal.Length)) +
geom_col(aes(fill = Species), position = "dodge") +
geom_text(aes(label=asterisks, group = Species), position = position_dodge(width = 1)) +
facet_grid(~Sepal_Group, labeller = label_parsed) +
theme(legend.position = "bottom", panel.background = element_blank(), panel.border = element_rect(colour = "black", …Run Code Online (Sandbox Code Playgroud)