Search code examples
csswebelementtargeting

How to target items


I have currently a main style sheet, but multiple pages using that sheet, i do not want to make multiple style sheets, as I am using PHP to out put it. How do I target specific elements such as a text area, Like:

<div id="regform" class="
<label>Password:</label>
<input name="Password" placeholder="Password"></input>

But the css is:

input
{
height:100px;
width: 500px;
padding: 10px;
}

That all works FINE! It creates the look I want, but that changes all text areas to look like that, and that is not what I want, I want only text areas in that div to look like that, as I use text areas alot.

Summary:

How do I change the look of textareas and elements in only ONE div? So it does not affect any other text area.

This is an edit! This did not work PLEASE LOOK AT THIS! http://jsfiddle.net/wbyQL/1/


Solution

  • HTML:

    <div id="regform" class="">
    <label>Password:</label>
    <input name="Password" placeholder="Password"></input>
    </div>
    

    CSS:

    #regform input
    {
    height:100px;
    width: 500px;
    padding: 10px;
    }
    

    http://jsfiddle.net/wbyQL/3/