HighDots Forums  

TextArea Cols or Width?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss TextArea Cols or Width? in the Cascading Style Sheets forum.

Reply
 
Thread Tools Display Modes
  #1  
Old   
shapper
 
Posts: n/a

Default TextArea Cols or Width? - 09-03-2008 , 07:27 AM






Hello,

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?

In this case what is the difference between cols and width?

I suppose I cannot define the cols in CSS.

Thanks,
Miguel



Reply With Quote
  #2  
Old   
Ben C
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 09:10 AM






On 2008-09-03, shapper <mdmoura (AT) gmail (DOT) com> wrote:
Quote:
Hello,

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?
No, but you can-- then people who aren't using CSS will get what you set
for cols instead of the 40em.

Quote:
In this case what is the difference between cols and width?
Cols is supposed to give you the width of an "average" character. Width
sets a width in one of the usual CSS units (which don't include "width
of average character").

If you set both, the CSS width wins in most browsers.

Quote:
I suppose I cannot define the cols in CSS.
Correct.


Reply With Quote
  #3  
Old   
Bergamot
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 09:56 AM




Ben C wrote:
Quote:
On 2008-09-03, shapper <mdmoura (AT) gmail (DOT) com> wrote:

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?

No, but you can
http://www.w3.org/TR/html401/interac...#edef-TEXTAREA

Note the required fields.

--
Berg


Reply With Quote
  #4  
Old   
shapper
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 10:00 AM



On Sep 3, 3:56*pm, Bergamot <berga... (AT) visi (DOT) com> wrote:
Quote:
Ben C wrote:
On 2008-09-03, shapper <mdmo... (AT) gmail (DOT) com> wrote:

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?

No, but you can

http://www.w3.org/TR/html401/interac...#edef-TEXTAREA

Note the required fields.

--
Berg
Yes, I knew that but somehow without cols I got my HTML validated ...
even If I had the opposite before


Reply With Quote
  #5  
Old   
shapper
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 10:02 AM



On Sep 3, 3:10*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote:
Quote:
On 2008-09-03, shapper <mdmo... (AT) gmail (DOT) com> wrote:

Hello,

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?

No, but you can-- then people who aren't using CSS will get what you set
for cols instead of the 40em.

In this case what is the difference between cols and width?

Cols is supposed to give you the width of an "average" character. Width
sets a width in one of the usual CSS units (which don't include "width
of average character").

If you set both, the CSS width wins in most browsers.

I suppose I cannot define the cols in CSS.

Correct.
If the TextArea has, let's say 100 columns, and is inside a DIV of
50px width will the Text Area expand the width?

Thanks,
Miguel


Reply With Quote
  #6  
Old   
Ben C
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 10:22 AM



On 2008-09-03, Bergamot <bergamot (AT) visi (DOT) com> wrote:
Quote:
Ben C wrote:
On 2008-09-03, shapper <mdmoura (AT) gmail (DOT) com> wrote:

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?

No, but you can

http://www.w3.org/TR/html401/interac...#edef-TEXTAREA

Note the required fields.
I stand corrected.


Reply With Quote
  #7  
Old   
Ben C
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 10:25 AM



On 2008-09-03, shapper <mdmoura (AT) gmail (DOT) com> wrote:
Quote:
On Sep 3, 3:10*pm, Ben C <spams... (AT) spam (DOT) eggs> wrote:
On 2008-09-03, shapper <mdmo... (AT) gmail (DOT) com> wrote:

Hello,

I am defining a Text Area where I set it to 20 Rows and Width of 40em
in my CSS code.

Do I need to define the cols?

No, but you can-- then people who aren't using CSS will get what you set
for cols instead of the 40em.

In this case what is the difference between cols and width?

Cols is supposed to give you the width of an "average" character. Width
sets a width in one of the usual CSS units (which don't include "width
of average character").

If you set both, the CSS width wins in most browsers.

I suppose I cannot define the cols in CSS.

Correct.

If the TextArea has, let's say 100 columns, and is inside a DIV of
50px width will the Text Area expand the width?
No, it will just overflow the div (unless you set display: table-cell on
the div).

If you set width: 50px on a normal block, you get 50px regardless of the
contents or of whether that's enough.


Reply With Quote
  #8  
Old   
Bergamot
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 12:10 PM




shapper wrote:
Quote:
On Sep 3, 3:56 pm, Bergamot <berga... (AT) visi (DOT) com> wrote:

http://www.w3.org/TR/html401/interac...#edef-TEXTAREA

Note the required fields.

Yes, I knew that but somehow without cols I got my HTML validated ...
The W3C validator gives an error when cols is omitted. e.g.

Error: required attribute "COLS" not specified .
<textarea name="x" rows="20"></textarea>

--
Berg


Reply With Quote
  #9  
Old   
shapper
 
Posts: n/a

Default Re: TextArea Cols or Width? - 09-03-2008 , 02:22 PM



On Sep 3, 6:10*pm, Bergamot <berga... (AT) visi (DOT) com> wrote:
Quote:
shapper wrote:
On Sep 3, 3:56 pm, Bergamot <berga... (AT) visi (DOT) com> wrote:

http://www.w3.org/TR/html401/interac...#edef-TEXTAREA

Note the required fields.

Yes, I knew that but somehow without cols I got my HTML validated ...

The W3C validator gives an error when cols is omitted. e.g.

Error: required attribute "COLS" not specified .
textarea name="x" rows="20"></textarea

--
Berg
You are right ...

Hmmm, it got validated because my MVC framework or TinyMCE, which I am
using, adds cols and rows with default values 20 and 2.

That's why ...


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.