4

If I override the HTML tag <STRONG> in CSS by specifying a different font weight and size, does it retain any other style settings or properties?

strong {
    font-weight:700;
    font-size: 12px;
}

I ask because I'm getting odd font weight differences between browsers (chrome and IE)

3
  • As Jukka suggests, I would have said this is likely to be simply differences between the browsers rendering. But it would be interesting to see a screenshot of the differences if possible?
    – MrWhite
    Aug 23, 2012 at 8:57
  • This sounds almost exactly like a previous question of your own, just with fewer details. Am I missing something here? Or, could you provide more to explain how this is different?
    – Su'
    Aug 23, 2012 at 9:28
  • no, this is a different situation, i am asking if there are any other properties that <STRONG> implies, other than making the text bold. Aug 23, 2012 at 10:34

2 Answers 2

4

You don’t really override markup in CSS, you just set properties on elements. Setting font-weight: 700 just coincides with browser defaults, as 700 equals bold. Setting font-size sets just that property, but this in turn may have complex and partly browser-dependent visual effect.

Without more information, this is just an educated guess: what you are seeing is rendering differences between browsers. Probably not font weight but e.g. differences in subpixel rendering, making stroke widths look a little different.

4
  • 1
    I dont agree with your first part - if i set font-weight to 800, for example, that overrides the standard font weight property implied by '<STRONG>' Aug 23, 2012 at 8:27
  • 2
    Yes, you don't override markup with CSS, but I don't think Darkcat is referring to markup, but simply the style of the element. Setting properties on an element in CSS overrides those CSS properties for that element. But, as Jukka suggests, browser X might set other properties (that might even be inaccessible to the user, such as font smoothing) on that element you are unaware of. As Jukka states, it is likely to be differences in the browser rendering (+1), that you have little control over.
    – MrWhite
    Aug 23, 2012 at 8:55
  • 1
    @Darkcat, property settings do not override elements, they at most override some presentational features (that is, property values set elsewhere). Setting font-weight to 700 does not do even that. Setting it to 800 changes the nominal value but mostly not the used value (for most fonts, only weights 400 and 700 are available). Aug 23, 2012 at 9:56
  • 2
    Failing actual links/screenshots, I side with Jukka that this is likely just browser differences. The simplest way for you to test this would be to create a document with only the CSS rule that's modifying this tag. If the difference remains, it's the browser. If it disappears, then the problem is somehow coming from another rule in your CSS and you'll have to hunt it down by similar means(eg. add things back bit by bit until you isolate it.) It is not true, however, that you can't modify font-smoothing, in case that factors in.
    – Su'
    Aug 23, 2012 at 10:46
0

Yes,
here you are overriding 2 css properties,
but if others are defined (by browser or another css rule) they will still be in use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.