• Resolved nberidze

    (@nberidze)


    How can I have a different font size (for example in the H2 headers) depending on language?

    One of our languages has longer headlines (for linguistic reasons) than the English version and we need to reduce the font size for headlines in that language.

    https://wordpress.org/plugins/polylang/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Chouby

    (@chouby)

    Thread Starter nberidze

    (@nberidze)

    Thanks. So if I for example have this in my style.css:

    h1,h2{color:#333;letter-spacing:0px;line-height:20px;padding:10px 0;margin:0;border:0;color:#333;font:34px Georgia,Times, Verdana,Arial,Sans-Serif;border:0;}

    ..and I want to define the current font size (34px) only for the English version, while for the other language, I want 20px. How do I write this line in style.css?

    And does the Polylang plugin set the language identifier?

    It will provided your theme does:

    <html <?php language_attributes() ?>>

    Then you can html:lang(en) h1 { font-size: 34px; }.

    Thread Starter nberidze

    (@nberidze)

    There is only one <html> tag in my theme’s header.php. Do you mean to put it inside there? (I’m not fluent in php, so maybe a silly question.)

    Thread Starter nberidze

    (@nberidze)

    I placed it inside the opening html tag in the header.php file, and that made it work (placing the relevant code in style.css).

    It was also useful for me to let php print the language attribute on the page to show me what it looks like. The English code was “en-US”, not “en”. (But shouldn’t it work with only “en” too?)

    Thank you both.

    The language pseudo-class matches a hyphen-separated substring of the lang attribute, so it would work with en, en-US, or en-CA.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Different font size depending on language’ is closed to new replies.