Tom8001 Posted December 26, 2014 Share Posted December 26, 2014 Hi, ok so i have just created a form in HTML and am having the following problem in CSS This is what the form looks like: http://gyazo.com/0aa86120ab01c1f660dcf8f30efe4f9d Now you can see that the width is covering the page each side How can i fix this? for both width and height? Here is my code: #form { background-color: #111; margin: 0; text-align: center; padding: 15px; width: auto; height: auto; color: yellow; } #form input { border: 2px solid #ff0000; color: #ff0000; } Quote Link to comment https://forums.phpfreaks.com/topic/293371-problem-with-width-on-form/ Share on other sites More sharing options...
Solution adam_bray Posted December 26, 2014 Solution Share Posted December 26, 2014 A form isn't your typical layout element and isn't really used for styling like you are. From what you've said.. your problem is that the form is display: block; change it to display: inline-block; and it should be sorted, but personally I'd wrap it in a div and style that. 1 Quote Link to comment https://forums.phpfreaks.com/topic/293371-problem-with-width-on-form/#findComment-1500752 Share on other sites More sharing options...
Tom8001 Posted December 26, 2014 Author Share Posted December 26, 2014 A form isn't your typical layout element and isn't really used for styling like you are. From what you've said.. your problem is that the form is display: block; change it to display: inline-block; and it should be sorted, but personally I'd wrap it in a div and style that. Worked perfectly thanks! Quote Link to comment https://forums.phpfreaks.com/topic/293371-problem-with-width-on-form/#findComment-1500757 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.