We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Technology

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What is a JavaScript® Style?

By Alex Newth
Updated: Feb 08, 2024
Views: 5,085
Share

A JavaScript® style is part of the JavaScript® code that affects the appearance, or styling, of a Web page. These styles can be broken into five sections: text, font, box, classification, and backgrounds and colors. Each section affects a different part of the Web page, according to the creator’s needs, and comes with its own set of tags.

Text JavaScript® style affects how the text appears on the site. Elements that can be altered here are the height of the lines, how the text is aligned and the size of the indentation for each paragraph. Text JavaScript® style does not affect how the font appears, only how the text is organized.

Font JavaScript® style is similar to text in that it affects the letters, but this style changes the appearance of the letters, not their organization. Areas that can be set with this type of JavaScript® style are font style and font family, whether all the letters are uppercased or lowercased, and how light or dark the letters are. Font family refers to what font the text will use, and font style refers to whether the text is normal, bold or italicized.

Boxes, or hypertext markup language (HTML) tables, are affected by box JavaScript® style. Other sections can also be altered with this style, but it is mainly used for tables. The areas affected here are the margins in all four directions. Setting a margin — for example, a 20-pixel margin at the top — will push the box downward by 20 pixels and will ensure that those 20 pixels of space at the top remain blank. This is commonly used to organize the entire Web page.

Classification JavaScript® style is made to affect lists, both numbered and bulleted. JavaScript® has only one attribute in this regard: listStyle. This affects how the list is organized with other elements on the page. For example, if you set listStyle to “inside,” then the list will appear inside another specified element.

The background and color style comes with two similar, but different, tags: backgroundColor and color. These two tags do exactly the same thing; they are used to set the color of the Web page. BackgroundColor is used to color the entire background of the Web page, though, while color is used only to set the color of an individual element. Colors can either be set by using the color’s name, such as green or red, or using the hexadecimal value of the color.

Share
WiseGeek is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.

Editors' Picks

Related Articles

Discussion Comments
Share
https://www.wise-geek.com/what-is-a-javascript-style.htm
Copy this link
WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.

WiseGeek, in your inbox

Our latest articles, guides, and more, delivered daily.