0

So currently I'm trying to edit the general layout and look of html input forms. Heres a snippet of my code for my html input forms:

<p> <form action='register.php' method="POST"></p>
<p>First Name: <input type="text" name="firstName" />Last Name: <input type="text"     name="lastName"/></p>
<p>Address: <input type="text" name="address" /></p>
<p>City: <input type="text" name="city" /></p>

And the css that edits this is:

#Address, #emailAddress, #password, #confirmPassword, #firstName, #lastName{
width:50%;
outline: double 1px #FFA500;  
height:16px; 
padding:10px;  
}

Problem is, nothing changes with this code. Shouldn't this change my html input forms?

0

4 Answers 4

2

Try using the id attribute instead of the name attribute on your html.

<input type="text" id="firstName" />
Sign up to request clarification or add additional context in comments.

Comments

2

It'd be much better to define a style for all of your input elements at once:

input { 
    width: 50%;
    outline: double 1px #FFA500;  
    height: 16px; 
    padding: 10px; }

You should read up on CSS selectors.

2 Comments

Thanks. This is good but I have custom parameters for each (they are all going to look different a little bit)
Still, it makes sense to define a base-style if you're sharing styles. As others have said, if you're looking for greater specificity look into using id or class attributes.
2

Here are some quick observations:

  • improper nesting of elements. Example, opened form tag within paragraph tag. Also, form tag isn't closed
  • use "id" attribute instead of "name"
  • be sure that #Address matches the input id (currently, it doesn't)
  • city input id isn't reflected in the CSS

Comments

0

You need to assign an ID or class to the input.

Remember, with CSS;

ID = #object
Class = .object

<p>First Name: <input type="text" name="firstName" id="firstName" />

2 Comments

I knew i was missing something! Thanks a lot!
Also, as @Wex mentioned, it'll save you time by defining a style for all of your input elements at the same time with one selector. Take a look at the code he posted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.