如何使中间的尖锐匹配文本行。文字不清晰
How make the middle sharp match the text line. The text is not in the sharp
编辑: 还有其他 post 回答了我的 post 但我让我的 post 在线因为有些人不知道那是关于"vertical alignment in flexbox"的把戏。我的主题允许用它做一个 link。
我尽量让锐字的中间与文本行相匹配。
我试过 flexbox 甚至 grid,但不知道哪里出了问题。
我想做什么:
这是我的 Jsfiddle,如果有人有任何想法:
http://jsfiddle.net/rkEMR/10617/
div{
display: flex;
align-items: center;
} #record {
grid-area: text;
border: solid;
border-color: #656666;
border-width: 1px;
margin-left: 3.8em;
margin-top: 0.3em;
width: 10rem;
height: 3rem;
background-color: white;
font-family: 'Tajawal', sans-serif;
font-size: 1.5em;
text-align: center;
}
#circle {
display: inline-block;
grid-area: symbol;
margin: 0;
padding: 0;
background: red;
width: 25px;
height: 25px;
text-align: center;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
/* padding-top: 5px;
line-height: 5em;*/
}
<div> <button id="record"> Record <div id="circle"> </div></button>
</div>
你的 flex 属性放错了地方。您需要将它们应用于要居中的元素的直接父级,即 #record
.
如果您申请:
#record {
display: flex;
justify-content: center;
align-items: center;
}
您按钮的内容将居中。
#record {
grid-area: text;
border: solid;
border-color: #656666;
border-width: 1px;
margin-left: 3.8em;
margin-top: 0.3em;
width: 10rem;
height: 3rem;
background-color: white;
font-family: 'Tajawal', sans-serif;
font-size: 1.5em;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
#circle {
display: inline-block;
grid-area: symbol;
margin: 0;
margin-left: 10px;
padding: 0;
background: red;
width: 25px;
height: 25px;
text-align: center;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
/* padding-top: 5px;
line-height: 5em;*/
}
<div> <button id="record"> Record <div id="circle"> </div></button>
</div>
编辑: 还有其他 post 回答了我的 post 但我让我的 post 在线因为有些人不知道那是关于"vertical alignment in flexbox"的把戏。我的主题允许用它做一个 link。
我尽量让锐字的中间与文本行相匹配。
我试过 flexbox 甚至 grid,但不知道哪里出了问题。
我想做什么:
这是我的 Jsfiddle,如果有人有任何想法:
http://jsfiddle.net/rkEMR/10617/
div{
display: flex;
align-items: center;
} #record {
grid-area: text;
border: solid;
border-color: #656666;
border-width: 1px;
margin-left: 3.8em;
margin-top: 0.3em;
width: 10rem;
height: 3rem;
background-color: white;
font-family: 'Tajawal', sans-serif;
font-size: 1.5em;
text-align: center;
}
#circle {
display: inline-block;
grid-area: symbol;
margin: 0;
padding: 0;
background: red;
width: 25px;
height: 25px;
text-align: center;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
/* padding-top: 5px;
line-height: 5em;*/
}
<div> <button id="record"> Record <div id="circle"> </div></button>
</div>
你的 flex 属性放错了地方。您需要将它们应用于要居中的元素的直接父级,即 #record
.
如果您申请:
#record {
display: flex;
justify-content: center;
align-items: center;
}
您按钮的内容将居中。
#record {
grid-area: text;
border: solid;
border-color: #656666;
border-width: 1px;
margin-left: 3.8em;
margin-top: 0.3em;
width: 10rem;
height: 3rem;
background-color: white;
font-family: 'Tajawal', sans-serif;
font-size: 1.5em;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
#circle {
display: inline-block;
grid-area: symbol;
margin: 0;
margin-left: 10px;
padding: 0;
background: red;
width: 25px;
height: 25px;
text-align: center;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
/* padding-top: 5px;
line-height: 5em;*/
}
<div> <button id="record"> Record <div id="circle"> </div></button>
</div>