How to change the h3 font-style to italic on only one page, using CSS and not creating classes?

  • javascript'om check the page, if necessary - change the style. if (location.href== '/mypage') { //заголовок.стиль = italic } - Jean-Claude
  • The following criteria will apply:  All formatting must be done with CSS. - Edgar Kiljak
  • if the structure of the pages is different, then you can link to the previous blocks of a particular page and use context selectors: header + .main > h3 - lexxl

2 answers 2

This is how you can do it.

 <h3 style="font-style: italic!important;">Текст</h3> 

But at the same time, in the main css should not be in h3! Important

  • Why should not? - Qwertiy
  • If basically it is! Important, then the rule of the main css will act. I mean, inside h3 is not the main rule. - Arcadiy
  • one
    inline important will kill anything jsfiddle.net/uqppL5tb - Qwertiy
  • I do not always work, why I did not understand, I have to excel. Well, in general, I gave the answer to the TSU, whether it will try it or not, the case is purely his personal, but it should work in my opinion. - Arcadiy

Not that this is impossible at all, but the support is bad:

 @document /* Правила для конкретной страницы */ url(http://example.com/), /* Правила для страницы, URL которой начинается с ... */ url-prefix(http://example.com/snippets/), /* Правила для страниц определенного домена */ domain(example.com), /* Правила для всех https страниц */ regexp("https:.*") { /* Сами стили */ h3 { font-style: italic; } } 

@document

CSS at-rule that limits the effect of styles within itself based on the URL of the document.

Warning: this is an experimental technology!
Full support only using the -moz prefix in Firefox older than version 6.0.