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; } Link to comment https://forums.phpfreaks.com/topic/293371-problem-with-width-on-form/ Share on other sites More sharing options...
adam_bray Posted December 26, 2014 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. 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! 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
Archived
This topic is now archived and is closed to further replies.