473,387 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

TextArea Cols or Width?

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
Sep 3 '08 #1
8 7497
On 2008-09-03, shapper <md*****@gmail.comwrote:
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.
Sep 3 '08 #2

Ben C wrote:
On 2008-09-03, shapper <md*****@gmail.comwrote:
>>
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
Sep 3 '08 #3
On Sep 3, 3:56*pm, Bergamot <berga...@visi.comwrote:
Ben C wrote:
On 2008-09-03, shapper <mdmo...@gmail.comwrote:
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
Sep 3 '08 #4
On Sep 3, 3:10*pm, Ben C <spams...@spam.eggswrote:
On 2008-09-03, shapper <mdmo...@gmail.comwrote:
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
Sep 3 '08 #5
On 2008-09-03, Bergamot <be******@visi.comwrote:
>
Ben C wrote:
>On 2008-09-03, shapper <md*****@gmail.comwrote:
>>>
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.
Sep 3 '08 #6
On 2008-09-03, shapper <md*****@gmail.comwrote:
On Sep 3, 3:10*pm, Ben C <spams...@spam.eggswrote:
>On 2008-09-03, shapper <mdmo...@gmail.comwrote:
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.
Sep 3 '08 #7

shapper wrote:
On Sep 3, 3:56 pm, Bergamot <berga...@visi.comwrote:
>>
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
Sep 3 '08 #8
On Sep 3, 6:10*pm, Bergamot <berga...@visi.comwrote:
shapper wrote:
On Sep 3, 3:56 pm, Bergamot <berga...@visi.comwrote:
>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 ...
Sep 3 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Phil Powell | last post by:
The customer made a wild request: they want on their admin panel a textarea that will display an existing resume. This textarea, however, must have a dynamic width, one that "fills the screen...
3
by: phil_gg04 | last post by:
Dear CSS Experts, I want to make a textarea fill all the available width. This is something I've done before but mostly by trial and error; now I want to understand what is going on. So I try:...
1
by: nospam | last post by:
Hi, I have an application whose textareas rows automatically resize onFocus to the number of lines in the textArea. The cols are set to 100% (in a CSS file) in order to always take the full...
4
by: TJS | last post by:
can the rows and columns of a textarea element with an id be changed on the fly ? if so is there an example ?
5
by: bwucke | last post by:
Is there any way to scroll textarea (to the bottom row) from Javascript in Opera? The textarea.scrollTop=textarea.scrollHeight+textarea.scrollTop; approach doesn't work, and there's so many...
6
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at...
6
by: gilbert.george | last post by:
Hi, I am setting the width of a textarea using the style.width to ensure the textarea is exactly the right width. I want to set the height/rows of the textarea depending on it's contents (so...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.