Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSSing a input type submit only - not for all inputs while i cannot use change the html at all

Tags:

html

css

I am trying to change the way a submit button looks - i am unable to us id or class or anything like that.

i have a div - inside this div 2 inputs 1 is a text the other is submit let say the div's class is holder.

<div class="holder">
<input type="text" name="somename" value="somevalue">
<input type="submit" name="submit" value="save changes">
</div>

my current css is:

.holder input, textarea {
width:250px;
}

However for this change both input types. and i am trying to change them individually.

like image 329
Neta Meta Avatar asked Sep 02 '12 01:09

Neta Meta


2 Answers

You can specify the specific attributes required for css properties:

.holder input[type=submit] {
  width:250px;
}

Reference: http://www.w3.org/TR/CSS2/selector.html#attribute-selectors

Basically, it means that the width property only applies to <input> tags inside the #holder container IF the type attribute has a value of "submit".

You can also use this on the name attribute:

.holder input[name=submit] {
  width:250px;
}
like image 69
ronalchn Avatar answered Oct 02 '22 19:10

ronalchn


The selector for the submit input would be:

.holder input[type="submit"]

Note that your div has a class of "holder", not an id of "holder", so use . not #.

like image 38
nnnnnn Avatar answered Oct 02 '22 18:10

nnnnnn