This guest post is by Andrew Couch of Learningwebbasics.com.
As a website owner it can be really handy to know a bit of web coding. The HTML editor in most blogging platforms gives you enough power to do a lot of cool things without any risk of screwing up your site.
Adding inline styles to elements is one of the easiest.
What are inline CSS styles?
CSS is the style language of the web. It describes to the browser how web pages should look to the last detail. These styles can be packed together in a style sheet and attached to a site as a whole. Or they can be added to individual elements to affect only that element, not the entire site.
This second way of applying CSS styles is called inline styling. These pieces of CSS are inline styles.
Why can they be the blogger’s best friend?
1. They’re easy to use
You can add an inline style in the HTML editor of your platform. Just a few pieces of code can go a long way. And all without hacking into your theme.
The most common element to style is the paragraph. An inline paragraph style would affect all of the text in the styled paragraph. In WordPress HTML editor you need to add the tags <p …> </p>.
Type this into your HTML editor:
<p style="border:1px solid red;padding:5px;">
This is the text that I want to affect.
This is how it’ll look in the visual editor, and the post itself:
P is the name of the element. It stands for paragraph.
Style is the name of the element that lets you define an inline style.
So border:1px solid red;padding:5px; is the style in the example. It adds a red border around the paragraph and a bit of spacing to keep the border from running into the text. Pretty easy!
2. They’re safe
Since you are working only in one post instead of the theme itself, there is no chance you could screw up your entire site. This is often a worry of novice coders—that one mistake could take down their site. Inline styles can give you a safe place to play with your creations.
Using inline styles could at most affect the one post you are working on. However if you use your blog’s Preview feature to look at the post before it gets published, you can reduce even that risk.
Styles only affect how specific elements look, not how the site functions. At most, mistakes mean the effect you are going for won’t be seen; they don’t result in a loss of functionality.
3. They are powerful
Many effects can be created on a specific element using inline styles. They do not need to remain as bland as changing the color, or be as functional as.
This tip callout floats next to your text and lets you push something out of the flow of the text to highlight it. It looks impressive, but is just a slightly more complex inline style.
<p style="padding: 10px; border: 1px solid #cccccc; background-color: #f9f595; width: 210px; float: right; margin: 0 0 5px 5px;">
How about a box set aside as a tip.
Why aren’t inline styles used more?
Themes for blogs and custom-built websites include a set of CSS rules that are attached to the site as a whole. This style sheet dictates how the site looks. This means you don’t need to use inline styles to achieve effects that fit within the overall theme style.
At a technical level, these overall styles are more efficient than using inline styles on every element. This just means that you would never use them to build an entire site. But inline styles are still very powerful and often overlooked as a way to impact certain elements in a single post.
Give inline styles a try
Basic knowledge of CSS can help you make small changes to the appearance of an individual post. It’s a simple way to make important parts of a post stand out, it can make your post look more professional, and it can break up the monotony.
Best of all, learning a few basics of CSS isn’t too complicated.
If you are intrigued about what CSS can do for you, check out the extensive list of examples at w3schools and their entire CSS section. These move beyond inline styles and into stylesheets, but can give you an idea of what’s possible for your blog.
Andrew Couch is a career web developer and author of a tech e-book for non-techs called Ctrl-Alt-Travel with his wife.. He also runs a travel blog at