简体   繁体   中英

Global text size and using different styles in same sentence

Ok two questions here:

1) What's the best way to set a global text size that would be consistent throughout all browsers? Or will there always be variance? Defining inside the like this?

    html {
        font-size: 1em;
         }

2) If I want something like this as a header at the top of my page:

The Portfolio of John Doe

what's the simplest way to get the first 3 words italic and the name in bold? I tried using a span tag but it was giving me weird sizing issues.

thanks in advance for any help

1) That is the best way to set the font sizes, If your really concerned about consistency you should check the user agent string to see which browser your in, but that seems like overkill
2) for the second part use the font style property

p.normal {font-style:normal}
p.italic {font-style:italic}
p.oblique {font-style:oblique}

1) Usually these styles are set on the body tag but other than that it's the way it should be done:

body {
    font-size: 1em;
}

2) Why not just use the html tags?

<i>The Portfolio of</i> <b>John Doe</b>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM