Jump to content

Problem with width on form


Go to solution Solved by adam_bray,

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

  • Solution

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.

  • Like 1

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!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.