devxlogo

Changing the Style of a String in JavaScript

JavaScript’s String object provides functions that display style of the text:

  1. big()
  2. blink()
  3. bold()
  4. fixed()
  5. fontsize(&ltsize&gt): This function takes a parameter to specify the font-size in pixels.
  6. fontcolor(““): This function takes a string parameter to specify font-color.
  7. italics()
  8. link(““): This function takes a string parameter to specify the URL.
  9. small()
  10. strike()
  11. sub()
  12. sup()
  13. toLowercase()
  14. toUppercase()

For example, to display selected text in italics:

var text = "Hi there!"document.write(text.italics()) //writes the string in italics

To set a link to a text:

document.write(text.link("http://www.devx.com")) //writes a hyperlinked string text

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Engineering Leaders Spot Weak Proposals

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

©2025 Copyright DevX - All Rights Reserved. Registration or use of this site constitutes acceptance of our Terms of Service and Privacy Policy.