Helpful Information
 
 
Category: CSS
i thnk this is css

i have a site, and want to make all the fonts throughout the whole thing the same, and want to be able to change all of them in 1 place. i know this is possible, but cant find out how. this also applies to colors for tables and such. thanks

i have a site, and want to make all the fonts throughout the whole thing the same, and want to be able to change all of them in 1 place.You need to link a style sheet into you documents:


<link rel="stylesheet" type="text/css" href="...">The .css file identified in the href attribute can now be used to suggest presentation for all of the documents that include it.

The rule


body {
font: 100% sans-serif;
}will change the 'body text' (nothing to do with the body element: normal text that appears in paragraphs, tables, etc.) to a generic sans serif font. You can suggest more specific type faces by including a comma-separated list of font family names, like Arial and Lucida Sans. If the family name contains spaces, you need to quote it with either single or double quotes. For example,


body {
font: 100% 'Lucida Sans', Arial, sans-serif;
}The order of the names reflects preference: if Lucida Sans is available it will be used, if not then the user agent will try Arial. If neither is available, it will use its generic alternative. You should always specify a generic family name, just in case.

Mike

thank you

thanks for that, another thing is that if i want the font for linkks, can i also specify that there is no color change. i want it to always be white. thank you again

sorry, i am very very new at css. how would you specify the size of the font

Rather than asking questions in a piecemeal fashion, might I suggest you stop whatever it is you're trying to do and learn CSS thoroughly. Having myself, or others, passing along tidbits of advice won't help you in the long run, but leave you running backwards and forwards every time you need assistance with the next little thing. I'm not trying to be mean, so don't take it that way, but you can't hope to be productive if you carry on this way.


if i want the font for linkks, can i also specify that there is no color change.You can, but you should be wary of doing so. Unless it's obvious - and I mean to strangers, not you - that some content is a link, you should always make sure that links are distinct from everything else.

To style a link, you need to use a specific selector (that is, a selector which explicitly identifies an a element) in order to override the user agent's default style sheet.


a {
background-color: ...;
color: white;
}Whenever you set colours, you should always set both the background any foreground colour simultaneously, otherwise a user agent with an unexpected default colour combination may render your page unreadable.


how would you specify the size of the fontIf you're specifying a type face at the same time, you can set the size using the shorthand font property.


font: 100% sans-serif;Font sizes are best expressed as percentages (of the user's default) and should not go lower than 85% in the vast majority of cases. However, you can use other units. The size will always go before the family list.

Mike










privacy (GDPR)