Is it possible to have several different textcolors in one textarea?
I'd like several words / phases in a textarea to appear in different colors... How would I go about doing this? Below is an example, I'd like the word green to appear green etc etc...
<textarea style="width: 100%; height: 100%; resize: none;">
Is it possible to have multiple colors in a textarea?
How would i set certain phases or words to be different colors?
"Green"
"Red"
"Blue"
</textarea>
html css
add a comment |
I'd like several words / phases in a textarea to appear in different colors... How would I go about doing this? Below is an example, I'd like the word green to appear green etc etc...
<textarea style="width: 100%; height: 100%; resize: none;">
Is it possible to have multiple colors in a textarea?
How would i set certain phases or words to be different colors?
"Green"
"Red"
"Blue"
</textarea>
html css
add a comment |
I'd like several words / phases in a textarea to appear in different colors... How would I go about doing this? Below is an example, I'd like the word green to appear green etc etc...
<textarea style="width: 100%; height: 100%; resize: none;">
Is it possible to have multiple colors in a textarea?
How would i set certain phases or words to be different colors?
"Green"
"Red"
"Blue"
</textarea>
html css
I'd like several words / phases in a textarea to appear in different colors... How would I go about doing this? Below is an example, I'd like the word green to appear green etc etc...
<textarea style="width: 100%; height: 100%; resize: none;">
Is it possible to have multiple colors in a textarea?
How would i set certain phases or words to be different colors?
"Green"
"Red"
"Blue"
</textarea>
html css
html css
edited Feb 1 '14 at 13:14
Benjamin
15.9k28120230
15.9k28120230
asked Aug 8 '10 at 16:47
DavidDavid
4,756123545
4,756123545
add a comment |
add a comment |
6 Answers
6
active
oldest
votes
You can't do this inside a <textarea>
, not one that's editable. It sounds like you're after a WYSIWYG editor, most of which use a <iframe>
to do this.
There are several JavaScript options for this, to name a few:
- TinyMCE
- CKEditor
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
add a comment |
I don't think its possible to do that with a textarea and html alone. What you need is a Rich Text box
You can either roll your own or use the popular ones available
Other option you can have when you target html5 enabled browsers is the contentEditable attribute. You can use it to make a textbox-like control
add a comment |
You cannot do this with a textarea or input tag. However, as @naikus mentioned, you can use the contenteditable attribute. It is as follows:
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span>
and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
add a comment |
This is not possible in a normal textarea.
For syntax highlighting-like approaches, see the answers to this question.
For a more complicated, full-fledged WYSIWYG solution that can do colours as well as other formatting, images, etc., see a WYSIWYG editor like CKEditor.
add a comment |
You can't do this with default html controls. You can use Rich Text Box editors to get what you want, for example check this question:
What is the best rich textarea editor for jQuery?
add a comment |
That's not possible with current w3c specs. If you're looking for a workaround, check codemirror or editArea for their workarounds for syntax highlighting.
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3435167%2fis-it-possible-to-have-several-different-textcolors-in-one-textarea%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can't do this inside a <textarea>
, not one that's editable. It sounds like you're after a WYSIWYG editor, most of which use a <iframe>
to do this.
There are several JavaScript options for this, to name a few:
- TinyMCE
- CKEditor
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
add a comment |
You can't do this inside a <textarea>
, not one that's editable. It sounds like you're after a WYSIWYG editor, most of which use a <iframe>
to do this.
There are several JavaScript options for this, to name a few:
- TinyMCE
- CKEditor
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
add a comment |
You can't do this inside a <textarea>
, not one that's editable. It sounds like you're after a WYSIWYG editor, most of which use a <iframe>
to do this.
There are several JavaScript options for this, to name a few:
- TinyMCE
- CKEditor
You can't do this inside a <textarea>
, not one that's editable. It sounds like you're after a WYSIWYG editor, most of which use a <iframe>
to do this.
There are several JavaScript options for this, to name a few:
- TinyMCE
- CKEditor
answered Aug 8 '10 at 16:51
Nick Craver♦Nick Craver
530k11511921098
530k11511921098
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
add a comment |
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
Sure you can! in-fact what you call a "rich text-box" editor is an editable div, highlighted using CSS or inline-styling (all of WordPress plugins, MCE and editors work this way. See answer below.
– user257319
Nov 7 '15 at 21:40
add a comment |
I don't think its possible to do that with a textarea and html alone. What you need is a Rich Text box
You can either roll your own or use the popular ones available
Other option you can have when you target html5 enabled browsers is the contentEditable attribute. You can use it to make a textbox-like control
add a comment |
I don't think its possible to do that with a textarea and html alone. What you need is a Rich Text box
You can either roll your own or use the popular ones available
Other option you can have when you target html5 enabled browsers is the contentEditable attribute. You can use it to make a textbox-like control
add a comment |
I don't think its possible to do that with a textarea and html alone. What you need is a Rich Text box
You can either roll your own or use the popular ones available
Other option you can have when you target html5 enabled browsers is the contentEditable attribute. You can use it to make a textbox-like control
I don't think its possible to do that with a textarea and html alone. What you need is a Rich Text box
You can either roll your own or use the popular ones available
Other option you can have when you target html5 enabled browsers is the contentEditable attribute. You can use it to make a textbox-like control
answered Aug 8 '10 at 16:53
naikusnaikus
21.3k43443
21.3k43443
add a comment |
add a comment |
You cannot do this with a textarea or input tag. However, as @naikus mentioned, you can use the contenteditable attribute. It is as follows:
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span>
and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
add a comment |
You cannot do this with a textarea or input tag. However, as @naikus mentioned, you can use the contenteditable attribute. It is as follows:
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span>
and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
add a comment |
You cannot do this with a textarea or input tag. However, as @naikus mentioned, you can use the contenteditable attribute. It is as follows:
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span>
and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
You cannot do this with a textarea or input tag. However, as @naikus mentioned, you can use the contenteditable attribute. It is as follows:
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span>
and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>
answered Nov 30 '16 at 21:15
IamGuestIamGuest
417314
417314
add a comment |
add a comment |
This is not possible in a normal textarea.
For syntax highlighting-like approaches, see the answers to this question.
For a more complicated, full-fledged WYSIWYG solution that can do colours as well as other formatting, images, etc., see a WYSIWYG editor like CKEditor.
add a comment |
This is not possible in a normal textarea.
For syntax highlighting-like approaches, see the answers to this question.
For a more complicated, full-fledged WYSIWYG solution that can do colours as well as other formatting, images, etc., see a WYSIWYG editor like CKEditor.
add a comment |
This is not possible in a normal textarea.
For syntax highlighting-like approaches, see the answers to this question.
For a more complicated, full-fledged WYSIWYG solution that can do colours as well as other formatting, images, etc., see a WYSIWYG editor like CKEditor.
This is not possible in a normal textarea.
For syntax highlighting-like approaches, see the answers to this question.
For a more complicated, full-fledged WYSIWYG solution that can do colours as well as other formatting, images, etc., see a WYSIWYG editor like CKEditor.
edited May 23 '17 at 12:02
Community♦
11
11
answered Aug 8 '10 at 16:51
Pekka 웃Pekka 웃
355k1168401012
355k1168401012
add a comment |
add a comment |
You can't do this with default html controls. You can use Rich Text Box editors to get what you want, for example check this question:
What is the best rich textarea editor for jQuery?
add a comment |
You can't do this with default html controls. You can use Rich Text Box editors to get what you want, for example check this question:
What is the best rich textarea editor for jQuery?
add a comment |
You can't do this with default html controls. You can use Rich Text Box editors to get what you want, for example check this question:
What is the best rich textarea editor for jQuery?
You can't do this with default html controls. You can use Rich Text Box editors to get what you want, for example check this question:
What is the best rich textarea editor for jQuery?
edited May 23 '17 at 12:25
Community♦
11
11
answered Aug 8 '10 at 16:52
Pavel MorshenyukPavel Morshenyuk
8,13842735
8,13842735
add a comment |
add a comment |
That's not possible with current w3c specs. If you're looking for a workaround, check codemirror or editArea for their workarounds for syntax highlighting.
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
add a comment |
That's not possible with current w3c specs. If you're looking for a workaround, check codemirror or editArea for their workarounds for syntax highlighting.
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
add a comment |
That's not possible with current w3c specs. If you're looking for a workaround, check codemirror or editArea for their workarounds for syntax highlighting.
That's not possible with current w3c specs. If you're looking for a workaround, check codemirror or editArea for their workarounds for syntax highlighting.
answered Aug 8 '10 at 16:54
SinanSinan
6,85563146
6,85563146
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
add a comment |
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
hmm someone downvoted, wonder why. I don't care about the 2 fake internet points gone from my profile, but would like to know the reason. anyone?
– Sinan
Nov 9 '15 at 0:01
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f3435167%2fis-it-possible-to-have-several-different-textcolors-in-one-textarea%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown