CSS is a style sheet language used for describing the look and formatting of a document written in HTML. It allows you to separate the presentation of your content from its structure. For example, you can define the color, size, and font of your text using CSS rules. A basic CSS rule consists of a selector and a declaration block. The selector targets the HTML elements you want to style, and the declaration block contains one or more property - value pairs.
/* This is a CSS comment */
p {
color: blue;
font - size: 16px;
}
In the above example, the p
is the selector, which targets all <p>
(paragraph) elements in the HTML document. The color
and font - size
are properties, and blue
and 16px
are their respective values.
Tumblr blogs are built on HTML. When customizing fonts, you need to understand which HTML elements you want to style. Common text - related HTML elements in a Tumblr blog include <h1>
- <h6>
(headings), <p>
(paragraphs), <a>
(links), etc. You can use CSS to target these elements based on their tag names, classes, or IDs.
font - family
: Specifies the font family for an element. You can use a single font name or a font stack (a list of fonts).font - size
: Determines the size of the font. It can be specified in pixels (px
), ems (em
), rems (rem
), percentages (%
), etc.font - weight
: Defines the thickness of the font, such as normal
, bold
, lighter
, or a numerical value (e.g., 400
for normal, 700
for bold).font - style
: Sets the style of the font, like normal
, italic
, or oblique
.One of the easiest ways to use custom fonts on your Tumblr blog is by linking to external font services like Google Fonts.
<link>
tag. Copy this tag and paste it into the <head>
section of your Tumblr theme’s HTML.<head>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans&display=swap">
</head>
font - family
property in your CSS to apply the font.body {
font - family: 'Open Sans', sans - serif;
}
If you have a custom font file (e.g., .ttf
, .woff
, .woff2
), you can embed it in your Tumblr blog using the @font - face
rule.
@font - face {
font - family: 'MyCustomFont';
src: url('path/to/your/font.woff2') format('woff2'),
url('path/to/your/font.woff') format('woff');
font - weight: normal;
font - style: normal;
}
body {
font - family: 'MyCustomFont', sans - serif;
}
You can apply different fonts to different HTML elements. For example, you might want to use a different font for headings and paragraphs.
h1, h2, h3 {
font - family: 'Lora', serif;
}
p {
font - family: 'Roboto', sans - serif;
}
A font stack is a list of fonts that the browser will try to use in order. If the first font is not available, it will try the next one.
body {
font - family: 'Open Sans', Arial, sans - serif;
}
In this example, the browser will first try to use ‘Open Sans’. If it’s not available, it will try Arial, and if that’s not available either, it will use the default sans - serif font of the browser.
loading="lazy"
attribute on the <link>
tag for external fonts to defer the loading of fonts until they are needed.Customizing fonts on your Tumblr blog using CSS and HTML is a great way to make your blog unique and engaging. By understanding the fundamental concepts, using the right usage methods, following common practices, and implementing best practices, you can create a visually appealing and accessible blog. Remember to test your changes thoroughly and always keep the user experience in mind. With a little creativity and knowledge, you can transform your Tumblr blog into a personalized and professional - looking space.