Aligning text and select boxes to the same width in CSS?

前端 未结 7 1641
误落风尘
误落风尘 2020-12-22 23:32

Ok this is seemingly impossible to get right. I have a text box and a select box. I want them to be the same width exactly so they line up on the left margin and the right m

7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-23 00:08

    Different browsers apply different styles by default. I found that resetting both margin and padding to 0 makes both elements equal widths in both Firefox and Chrome.

    
        
            Test
            
        
        
            

    I personally like to use a minimal CSS reset stylesheet like YUI CSS Reset before attempting to make a design look great in multiple browsers.

提交回复
热议问题