Как сделать текст жирным css

How to make my font bold using css?

I’m very new to HTML and CSS and I was just wondering how I could make my font bold using CSS.

I have a plain HTML page that imports a CSS file, and I can change the font in the CSS. But I don’t know how to make the font bold, can anyone help me?

10 Answers 10

You can use the CSS declaration font-weight: bold; .

I would advise you to read the CSS beginner guide at http://htmldog.com/guides/cssbeginner/ .

You can use the strong element in html, which is great semantically (also good for screen readers etc.), which typically renders as bold text:

Or you can use the font-weight css property to style any element’s text as bold:

You’d use font-weight: bold .

Do you want to make the entire document bold? Or just parts of it?

Sine you are new to html here are three ready to use examples on how to use CSS together with html. You can simply put them into a file, save it and open it up with the browser of your choice:

This one directly embeds your CSS style into your tags/elements. Generally this is not a very nice approach, because you should always separate the content/html from design.

The next one is a more general approach and works on all "p" (stands for paragraph) tags in your document and additionaly makes them HUGE. Btw. Google uses this approach on his search:

You probably will take a couple of days playing around with the first examples, however here is the last one. In this you finally fully seperate design (css) and content (html) from each other in two different files. stackoverflow takes this approach.

In one file you put all the CSS (call it ‘hello_world.css’):

In another file you should put the html (call it ‘hello_world.html’):

Hope this helps a little. To address specific elements in your document and not all tags you should make yourself familiar with the class , id and name attributes. Have fun!

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *