3 Suggestions for CSS Beginners
Still somewhat new to CSS? Below are three suggestions to help improve your coding:
1) External, Not Internal
There are three ways to apply CSS styles to your web site:
- Use Internal CSS
- Use Inline CSS
- Use an External Style Sheet
Internal (or “embedded”) CSS is a set of CSS properties specified within the head tags of your page. For instance, if you want the background of your page to be black, you could do this:
<html>
<head>
<title>My Web Site</title>
<style type="text/css">
body {
background-color: #000;
}
</style>
</head>
Inline CSS is similar, except that the properties are applied directly to specific elements within the page. For instance, if you want one paragraph to have a 20px margin above it, you could do this:
<p style="margin-top: 20px">This is my sample paragraph.</p>
