views:

172

answers:

3

I just had a quick css form question. I am trying to get the textarea's rows, and cols attribute set in css. So for example how can I do this in CSS.

+3  A: 

width and height are used when going the css route.

.comments { width:300px; height:75px; }

<textarea class="comments"></textarea>
Jonathan Sampson
A: 

As far as i know you cant.

Besides, that isnt what css is for anyway. Css for styling and HTML for markup.

EDIT: Cool, i stand corrected.

Moulde
CSS is for styling the visual representation of an element. This includes the width and height of a textarea.
Jonathan Sampson
Yeah, exactly.I didn't know cols and rows, and width and height were the same.
Moulde
Moulde, you're correct in that they're not *exactly* the same. But they both achieve the same purpose :)
Jonathan Sampson
A: 

I don't think you can. I always go with height and width.

textarea{
width:400px;
height:100px;
}

the nice thing about doing it the CSS way is that you can completely style it up. Now you can add things like:

textarea{
width:400px;
height:100px;
border:1px solid #000000;
background-color:#CCCCCC;
}
Code Monkey