Cascading Style Sheets come in three flavors: internal, external, and inline. We will cover internal and external, as they are the only flavors a designer should utilize. In this lesson, we cover the basics of the easier type, internal. When using internal CSS, you must add a new tag, <style>, inside the <head> tag. The HTML code below contains an example of <style>'s usage.
This doesn't actually do anything visually. The code style tag just tells the browser that we will be defining some CSS to be used on this page.
You probably noticed that in our CSS code we were altering the <body> and <p> HTML tags. The great thing about CSS is that it is an intuitive language. Once you understand the general format for CSS code, you are pretty much set.
General CSS Format:
CSS Code:
<html>
<head>
<style type="text/css">
</style>
</head>
<body>
<p>Your page's content!</p>
</body>
</html>
Creating Internal CSS Code
CSS code is not written the same way as HTML code is. This makes sense because CSS is not HTML, but rather a way of manipulating existing HTML. Below is an example of some simple, yet fully functional, CSS code.CSS Code:
<html>
<head>
<style type="text/css">
p {color: white; }
body {background-color: black; }
</style>
</head>
<body>
<p>White text on a black background!</p>
</body>
</html>
Display:
White text on a black background!
General CSS Format:
- "HTML tag" { "CSS Property" : "Value" ; }
- We chose the HTML element we wanted to manipulate. - p{ : ; }
- Then we chose the CSS attribute color. - p { color: ; }
- Next we choose the font color to be white. - p { color: white; }
- We choose the HTML element Body - body { : ; }
- Then we chose the CSS attribute. - body { background-color: ; }
- Next we chose the background color to be black. - body { background-color: black; }
Internal CSS Gotta Knows
- Place your CSS Code between <style> and </style>
- Be sure you know the correct format(syntax) of CSS code.
- CSS will literally save you hours of time... after you spend a few getting the hang of it.
0 comments
একটি মন্তব্য পোস্ট করুন