Skip to main content
Inspiring
December 30, 2020
Answered

Change the color of single word of selected text with keyboard shortcuts?

  • December 30, 2020
  • 2 replies
  • 655 views

Is there a way to change the color of single word of selected text with keyboard shortcuts?

Thanks.

This topic has been closed for replies.
Correct answer Jon Fritz

Not really, no. 

Text color is controlled by CSS. You would need to wrap your text in a set of <span> tags that also have a class added to them. That class would then have a selector in your .css file with the color property and whatever value you'd like to set.

You could create a wrapping Snippet of a set of span tags with a class, then highlight the text you want to change to a given color and double click the Snippet in the Snippets window to add it to the text...

1. Open your Snippets Window under Window > Snippets (or hit Shift + F9)
2. Click the New Snippet button (document with + icon) in the bottom of the Snippets window
3. In the dialogue that appears, give the Snippet a name, like Red Text
4. Ensure "Wrap Selection" is active
5. For "Insert Before" add something like... <span class="redtext">
6. For "Insert After" add in... <span>
7. Click OK
8. Between the page's <style> tags or in your .css file, add the selector...
  .redtext{color:red;}

From there on out, while working on that page or site, you can highlight text in Design View and doubleclick the Red Text snippet to wrap the selection in the span tags and turn it red.

2 replies

Nancy OShea
Community Expert
Community Expert
December 30, 2020

"I don't understand the function of the "<style> section"

Hi @gian carlog61267382,

Learn code.  It's the single most important investment you can make. Read chapters, work with code samples, take quizzes at the end.

- https://www.w3schools.com/html/
- https://www.w3schools.com/css/
- https://www.w3schools.com/js/

Reset keyboard shortcuts to default settings.

 

Nancy O'Shea— Product User & Community Expert
Jon Fritz
Community Expert
Jon FritzCommunity ExpertCorrect answer
Community Expert
December 30, 2020

Not really, no. 

Text color is controlled by CSS. You would need to wrap your text in a set of <span> tags that also have a class added to them. That class would then have a selector in your .css file with the color property and whatever value you'd like to set.

You could create a wrapping Snippet of a set of span tags with a class, then highlight the text you want to change to a given color and double click the Snippet in the Snippets window to add it to the text...

1. Open your Snippets Window under Window > Snippets (or hit Shift + F9)
2. Click the New Snippet button (document with + icon) in the bottom of the Snippets window
3. In the dialogue that appears, give the Snippet a name, like Red Text
4. Ensure "Wrap Selection" is active
5. For "Insert Before" add something like... <span class="redtext">
6. For "Insert After" add in... <span>
7. Click OK
8. Between the page's <style> tags or in your .css file, add the selector...
  .redtext{color:red;}

From there on out, while working on that page or site, you can highlight text in Design View and doubleclick the Red Text snippet to wrap the selection in the span tags and turn it red.

Inspiring
December 30, 2020

Thenk you Jon!

I Marked the answear like correct because it is.
But that means that the developer of dreamweaver doesn't implement an useful short cut!
This make a pair with another my perplexity: for different years a very boring bug ("shift + i" work like copy ) that is sill not solved!!!