AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL

CSS text bold - font-weight property


<< Previous Page
HTML comment
Next Page >>
div class container

CSS Tutorial » CSS text bold - font-weight property

Study in this chapter:
1. - How do you make text bold in CSS?
2. - CSS font-weight style
3. - bold text: in line, in span, in div, color, shadow

The font-weight property determines how thick or thin the characters in the text displayed on the screen should be.

We can add font-weight property to an element as:
Inline - by using the style attribute in HTML elements
Internal - by using a <style> element in the <head> section
External - by using an external CSS file as style.css

Syntax:

Syntax: Internal & External CSS.
/* Keyword values */
font-weight: normal;
font-weight: bold;

/* Keyword values relative to the parent */
font-weight: lighter;
font-weight: bolder;

/* Numeric keyword values */
font-weight: 100;
font-weight: 200;
font-weight: 300;
font-weight: 400; /* normal */
font-weight: 700; /* bold */
font-weight: 800;

/* Global values */
font-weight: inherit;
font-weight: initial;
font-weight: revert;
font-weight: revert-layer;
font-weight: unset;

Syntax: Inline CSS.
<tag style="font-weight: normal or bold or bolder or lighter or number or initial or inherit;">Yor text here</tag>

Syntax: HTML Simple text bold.
<strong>Yor text here</strong>
Note: use external CSS instead.

Example:

This bold element has a font-size: 18px and font-weight: bold

 

Browser Support font-weight property

Element chrome browser
 Chrome
ie browser
 IE
firefox browser
 Firefox
opera browser
 Opera
safari browser
 Safari
CSS border padding Yes Yes Yes Yes Yes

 

Text bold CSS in span and in div.

Website developers, when they want to draw attention to something, have a number of ways at hand to do this.
The most basic is to increase the font weight of the text you want to highlight.
This refers to making the text appear encouraged.

Below we show you an example of bolding a text inside an element such as div and span using internal CSS style.

In the example below I used: span{ font-weight: bold; font-size: 16px; font-family: Arial; color: #006; } .container{ font-family: "Times New Roman"; font-size: 20px; font-weight: 800; color: #930; }

Example:

<!DOCTYPE html>
<html>
<head>
<style>
span{
font-weight: bold;
font-size: 16px;
font-family: Arial;
color: #006;
}
.container{
font-family: "Times New Roman";
font-size: 20px;
font-weight: 800;
color: #930;
}
</style>
</head>

<body>

<span>My text bold using &lt;span&gt; tag</span>
<div class="container">My text bold using &lt;div&gt; tag </div>

</body>
</html>

In HTML, there are three major ways you can use to bold text. You can use the <b> tag, the <strong> tag, or in CSS with the font-weight property.

Related subjects:
text color text shadow font size

 

CSS text bold on hover

Below we show you an example of bold text on hover, inside a div

Example:

<!DOCTYPE html>
<html>
<head>
<style>

.container{
font-family: "Times New Roman";
font-size: 20px;
color: #F00;
}
.container:hover{
font-family: "Times New Roman";
font-size: 20px;
color: #039;
font-weight: bold;
}
</style>
</head>

<body>

<div class="container">My bold text on :hover inside a &lt;div&gt; label </div>

</body>
</html>

Tags: style, mdn, hover in line, in span, font size, in div, color, shadow, without changing width, not working

 

Bold text inline

We used inline CSS as: <div style="font-family:Times New Roman; font-size:20px; color:#039; font-weight:bold;">My bold text in line of &lt;div&gt; tag - no &lt;style&gt; in the &lt;head&gt;</div>

Example:

<!DOCTYPE html>
<html>
<head>

</head>

<body>

<div style="font-family:Times New Roman; font-size:20px; color:#039; font-weight:bold;">My bold text in line of &lt;div&gt; tag - no &lt;style&gt; in the &lt;head&gt;</div>
<p>&nbsp;</p>
<div>My simple text in the other box</div>
</body>
</html>

 

Summary of description

 

<< Previous Page
HTML Button Style
Next Page >>
HTML Button Action

 



Text Bold, italic, property, style, on hover, font, size, not working, code, on hover, italic, font, property, tag, size, code
CSS text bold - font-weight property - css tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


CSS Scrollbar Horizontal
CSS Scrollbar in Div
CSS Scrollbar Firefox
CSS Style Scrollbar
CSS Style Text
CSS background color
CSS Div Id Class
CSS Text Wrap
CSS text-align
CSS Text Decoration
CSS Text Shadow
CSS Text Color
CSS Text Bold
CSS Text Size
CSS background image full
CSS background opacity
CSS border radius
CSS rounded corners
CSS font color
CSS Class & ID
CSS align image center
CSS align content
CSS link color
CSS Text Style
CSS Text Font Size
CSS max width &height
CSS width and height
CSS Margin
CSS Padding
CSS Border Style
CSS background
CSS in HTML
Basic Syntax of CSS
CSS Introduction
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


Upload Image, display, edit and delete i...
Login Form with Image background...
How to Create an Image with Transparent ...
Portfolio Gallery Website with filtering...
Simple pagination script PHP MySQLi...
Center Image in div...
Image Hover Overlay Fade...
Sticky image / element / div on scroll...
Responsive images...
Create rounded image in HTML CSS...
Add border around image...
Position Text Over an Image HTML CSS res...
Create a Slideshow Images Gallery...
Create a Sticky Sidebar...
Search bar using CSS HTML...
Shrink Navigation Menu on Scroll...
How to Create Accordion HTML Templates...
Dropdown menu in the navigation bar...
Responsive Top Navigation Bar with mobil...
Split horizontal navigation bar...