Place input box at the center of div

后端 未结 5 1993
借酒劲吻你
借酒劲吻你 2020-12-08 09:59

I have a div, and I want the input box to be place at it\'s center. How can I do this?

5条回答
  •  一整个雨季
    2020-12-08 10:18

    The catch is that input elements are inline. We have to make it block (display:block) before positioning it to center : margin : 0 auto. Please see the code below :

    
    
        
    
    
    
        

    But if you have a div which is positioned = absolute then we need to do the things little bit differently.Now see this!

      
         
        
    
    
    
        

    Hoping this can be helpful.Thank you.

提交回复
热议问题