简体   繁体   English

同一行中的两个文本一个对齐,另一个对齐

[英]Two texts in the same line one aligned left the other centered

I have a silly problem. 我有一个愚蠢的问题。 I want two texts to stay in the same line, but one text-align: left; 我希望两个文本保持同一行,但一个text-align: left; and the other one text-align: center; 另一个text-align: center;

What's the correct way to do that? 正确的方法是什么?

 .number{ text-transform:uppercase; letter-spacing:1px; text-align:left; display:inline; width: 50px; margin-top:-10px; float:left; font-size:18px; } .menutitle{ display:block; text-transform:uppercase; letter-spacing:1px; text-align:center; font-size:18px; margin-bottom:31px; } 
 <span class="number">00</span><span class="menutitle">TEXT</span> 

You can do this with Flexbox 您可以使用Flexbox做到这Flexbox

 .element { display: flex; } .menutitle { flex: 1; text-align: center; background: lightgreen; } 
 <div class="element"> <span class="number">00</span> <span class="menutitle">TEXT</span> </div> 

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将这两个放在同一行? (一个居中,一个右对齐) - how to put these two on the same line? (one centered, one right aligned) 连续两个元素,一个左对齐,一个居中,如何? - Two elements in a row, one left aligned and one centered, how? 两部分导航。 一个居中,另一个右对齐 - Two part navigation. One centered and the other right aligned 我想使标题位于同一行的中心,两个浮点数分别向左和向右浮动 - I want to have a title centered on the same line as two floats one to left and one to right 如何在同一行上有两个DIV,一个不带HTML表格,一个左对齐,一个右对齐? - How can I have two DIV s on the same line , one aligned to the left and one aligned to the right without an HTML table? 两列布局 - 内容一列居中,但另一列顶部与居中内容的顶部对齐 - Two column layout - content one colulmn centered but the other column top aligned to the top of the centered content 如何仅使 Flex 列的文本的一部分居中,而另一部分左对齐? - how to make only one part of Flex column's text centered, and other part left-aligned? 两个文本对齐。 一个以上的图像 - Two texts aligned. One over an Image 材质用户界面。 网格内的 2 个项目; 一个左对齐,一个右对齐。 在同一行 - Material UI. 2 items inside a grid; one left-aligned, one right-aligned. In the same line 居中并向左对齐-引导程序 - Centered and aligned left - Bootstrap
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM