簡體   English   中英

鉻和Firefox的不同顯示

[英]diffrent display in chrome and firefox

我有這個樣式表,我的數字必須在文本框中垂直居中,在Firefox中也可以,但是在chrome中它顯示出與眾不同

 *{ box-sizing: border-box } html{ font-size: 13px; } body{ direction: rtl; } html, body, div, span{ margin: 0; } .textContainer{ position: relative; } .textBox{ padding: 0 0 0 45px; height: 40px; width: 100%; direction: ltr; } .mobile-number{ background: url(phone.png) no-repeat scroll 7px center; padding: 0 0 0 46px; position: absolute; left: 0; line-height: 42px; width: 10px; } 
 <div class="textContainer"> <input type="text" class="textBox"/> <span class="mobile-number">09</span> </div> 

 *{ box-sizing: border-box } html{ font-size: 13px; } body{ direction: rtl; } html, body, div, span{ margin: 0; } .textContainer{ position: relative; } .textBox{ padding: 0 0 0 45px; height: 40px; width: 100%; direction: ltr; } .mobile-number{ background: url(phone.png) no-repeat scroll 7px center; padding: 0 0 0 46px; position: absolute; left: 0; line-height: 42px; width: 10px; top:0 } 
 <div class="textContainer"> <input type="text" class="textBox"/> <span class="mobile-number">09</span> </div> 

干得好

firefox可以在position:absolute之后默認設置Top:0 ,而chrome在設置為top:0之前不會做同樣的事情

因此只需添加.mobile-number{top:0}您的問題就會得到解決

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM