First time here? Check out the FAQ!
1

How to create localization language-specific css?
 

The navigation icons (tags, people, badges) combine sprites + text.

When the text gets sufficiently long, the sprite regions overlap, and the last one continues on to show white space. I think this is a bug. It happens with german words, which can get very long.

My fix was to set a fixed width, in skins/default/media/style/style.less:

#navTags{
    .sprites(-50px,-5px);
    width: 50px;
}

#navUsers{
    .sprites(-125px,-5px);
    width: 59px;
}

#navBadges{
    .sprites(-210px,-5px);
    width: 47px;
}

But I don't know much CSS... I guess there must be a better way to clip the visible sprite region, and fall back to the background color outside of it. Ideas?

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
piskvorky's avatar
350
piskvorky
asked 13 years ago
Evgeny's avatar
13.2k
Evgeny
updated 13 years ago

Comments

see more comments

1 Answer

1

Now we have language code included as class on the html body element, so for languages other than english just add another class qualifier to the style source code.

For example:

body.lang-de #navBadges {
       width:   60px;
}

We should really have these fixes in the default skin.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 13 years ago, updated 13 years ago
link

Comments

but that's basically the same solution... isn't there a way to only show the image background with fixed width, and if the text is longer, leave transparent background? that would be more flexible.

piskvorky's avatar piskvorky (13 years ago)

Ah, ok, we should just restructure the sprites - probably should make them laid out vertically.

Evgeny's avatar Evgeny (13 years ago)

yes, that's also a solution :) to make the horizontal spacing between individual sprites larger, or even place them vertically

piskvorky's avatar piskvorky (13 years ago)
1

And don't forget about RTL, text should be able to fit on either side.

Basel Shishani's avatar Basel Shishani (13 years ago)
see more comments