텍스트와 함께 디스플레이 인라인 블록 이상한 행동이 내 code입니다 :CSS - 새로운 라인
CSS
<div>
<span class="prodotto_pulsante_testo_centrato">
<span class="prodotto_pulsante_testo_titolo">
operativo
<span class="prodotto_pulsante_testo_numero">4</span>
</span>
</span>
</div>
<div>
<span class="prodotto_pulsante_testo_centrato">
<span class="prodotto_pulsante_testo_titolo">
sportello operativo
<span class="prodotto_pulsante_testo_numero">4</span>
</span>
</span>
</div>
빨간색 상자 display:inline-block;
있습니다
div
{
height:30px;
}
.prodotto_pulsante_testo_centrato
{
display:block;
text-align:center;
margin-left:auto;
margin-right:auto;
width:120px;
}
.prodotto_pulsante_testo_numero
{
display:inline-block;
width:23px;
position:absolute;
left:-31px;
bottom:-1px;
background-color:green;
}
.prodotto_pulsante_testo_titolo
{
display:inline-block;
margin-left:23px;
position:relative;
background-color:red;
text-align:left;
}
HTML. 상자에서 가장 긴 단어는 "operativo"입니다. 그래서 나는 같은 수직선에 정렬됩니다.
두 번째 상자에는 텍스트의 새 줄이 있는데, 이는 부모 div의 120 픽셀이므로 prodotto_pulsante_testo_titolo
을 가장 높은 너비로 밀어 넣습니다.
왜이 동작입니까? Firefox와 Chrome에서 동일하다고 생각합니다. 그것은 당신이이 작업을 수행 할 경우, 다음 경기를 빨간색 상자의 < BR/>
폭을 넣어 IE에 I 측면 :
aspect -> expect; '가장 높은 너비'이게 무슨 뜻입니까? 어떻게 작동시키고 싶니? – Elen
sportero operativo가 한 줄에 또는 두 줄로 표시 되길 원하십니까? sportello operativo를 한 줄에 표시하려면 부모 div 폭을 늘려야합니다. 이 예제에서와 같이 http://jsfiddle.net/trickeedickee/sMyGV/4/ – frontendzzzguy
과 같이 시도해 볼 수 있습니다. white-space : nowrap; –