Jump to content

Problem with width on form


Tom8001

Recommended Posts

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

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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.