Forum Moderators: not2easy
Below is an example, and I have the following questions:
1) Why are there pound signs infront of some statements, but not others?
2) What steps would I need to go through to convert it to external? Is it as simple as removeing the pound characters and sticking it in a .css file?
3) What would be the correct syntax to include the external stylesheet?
<style type="text/css">
@import="css.css"
?
Again, sorry if the questions are dumb. I'm totally lost.
-thanks
<style type="text/css">
<!--/* >>>>> Page Styles <<<<< */
html, body {margin: 0; padding: 0; font-size: 100%; }
body {
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 80%;
color: #000;
background: #9ba49b; }
#pagetitle {
margin: 0;
padding: 10px 0 0 0;
text-align: center;
font-size: 210%;
color: #771464; }
pre {
margin: 0 0 0 10px;
padding-top: 8px;
font-family: Verdana, sans-serif;
font-size: 95%;
font-weight: normal; }
p {margin: 0; padding: 8px 7px 0 10px; }
#contents p {font-weight: bold; }
.altcolor {color: #eef7e2; font-weight: bold; }
.altcolor2 {color: #cde7a8; }
.altcolor3 { color: #771464; font-weight: bold; }
#demotext {
border: 2px solid #233622;
background: #cde7a8;
color: #233622;
margin: 8px 149px 5px 10px;
padding: 0 5px 5px 0;
position: relative; } /*** for IE6 ***/
a:link {color: #eef7e2; text-decoration: underline; padding: 1px; }
a:visited {color: #eef7e2; text-decoration: underline; padding: 1px; }
a:hover {color: #000; background: #eef7e2; text-decoration: underline; padding: 1px; }
#leftbox a:link, #leftbox a:visited {color: #233622; text-decoration: underline; }
.right a:link strong, .right a:visited strong, .right a:link, .right a:visited {
color: #000; text-decoration: underline; background: #eef7e2; padding: 1px; }
/*** Redundancy in this selector and the one below allows Op6 to display links properly ***/
.right a:hover strong, .right a:hover {color: #771464; background: #f4e6ef; padding: 1px; }
#contents a:link, #contents a:visited {
color: #000; text-decoration: underline; background: #f4e6ef; padding-top: 0; }
#contents a:hover {color: #f9f; background: #233622; padding-top: 0; }
#footer a:link, #footer a:visited {color: #771464; }
strong {font-weight: bold; color: #233622; }
pre strong {color: #000; }
#contents strong {color: #f9f; }
#contents pre.altcolor2 strong {color: #cde7a8; }
.alignright {margin: 0; padding: 1em 10px 2.5em 0; text-align: right; }
.small {font-size: .9em; color: #771464; }
.alignright strong {color: #771464; font-weight: bold; }
.decoration {float: right; margin: 0.5em 1em 3px 3px; position: relative; } /*** for IE6 ***/
html[xmlns] .decoration {margin: 0 1em 0 0; } /*** Moz put the image too low ***/
.kudos {
margin-top: 3em;
border-top: 3px double #233622;
border-bottom: 3px double #233622;
padding-bottom: 5px; }
#bottom {font-size: 1px; line-height:0; margin:0; padding:0;}
/* *****>>>>> Demo Styles <<<<<***** */
/*** The #header div has a static position and a background image ***/
#header {
margin: 0;
padding: 0;
background: url("images/waterlilies6.jpg") 0 0 no-repeat; /*** this is a shorthand
property for the various
background properties ***/
height: 100px; } /*** must be set so the following absolutely positioned divs are
placed correctly on initial load of the page***/
#leftbox {
position: absolute;
left: 0px;
width: 215px;
border-top: 1px solid #000;
background-color: #9ba49b;
color: #000;
padding-top: 5px; }
#container {
margin-left: 215px;
background: #faf5f8 url("images/rightbg.gif") 100% 0 repeat-y;
border-left: 1px solid #000; }
#navmenu {
background-color: #879186;
border: 1px solid #000;
border-width: 1px 0;
padding: 3px 0;
position: relative; } /*** IE6 needs this to display the div ***/
/* Hide from IE5-Mac \*/
* html #navmenu {height: 1%;}
/* end hide *//*** This hack will make IE5-win display the background color for the nav ***/
#navmenu ul {
display: block;
list-style: none;
padding: 0;
margin: 0;
font-family: Verdana, sans-serif;
text-align: center;
line-height: 1.2em; }
#navmenu ul li {
font-weight: bold;
display: block;
float: left;
position: relative; /*** IE6 needs this to display the links ***/
padding: 1px 0;
margin: 3px 0;
width: 10em;
border-right: 2px solid #000; }
#navmenu ul li.first {
margin-left: 0;
list-style: none; }
#navmenu ul li.last {
border-right: none; }
#navmenu a {
padding: 3px 0;
color: #000; }
#navmenu a:hover {
color: #faf5f8;
background: #879186; }
#navclear {
display: block;
clear: both; }
/*** IE5/Mac has trouble with right positioned boxes due to a secret margin. See
- http://www.l-c-n.com/IE5tests/right_pos/index.shtml - Philippe Wittenbergh's page
for an explanation of this problem and Sam Foster's page for an explanation of the
hack used - http://www.sam-i-am.com/testsuite/css/mac_ie5_hack.html - ***/
#rightbox {
position: absolute;
right: 16px;
margin-right: -15px;
width: 138px;
padding-top: 5px; }
/* hide the following from IE5-Mac \*/
#rightbox {
right: 0;
margin-right: 0; }
/* IE5-Mac can see the rest */
#wrapper {
margin-right: 138px;
padding-top: 5px; }
/*** Tan hack for IE. Only IE browsers see this selector.
This replaces the old Tantek hack. Please see Edwardson Tan's page.
http://www.info.com.ph/~etan/w3pantheon/style/modifiedsbmh.html ***/
* html #wrapper {
width: 100%; /*** IE5.5 needs this value to eliminate a horizontal scrollbar ***/
w\idth: auto; } /*** resets the value for IE6 and IE5-Mac ***/
.left {
float: left;
margin-left: 6px;
width: 43%;
padding: 5px 5px 5px 0;
background: #c3c8c3; }
html>body .left {margin-left: 12px; } /*** IE doubles the margin on the float. This sets
the margin to the correct width for others ***/
.right {
float: right;
margin-right: 6px;
width: 43%;
padding: 5px 5px 5px 0;
background: #c3c8c3; }
html>body .right {margin-right: 12px; } /*** IE doubles the margin on the float. This sets
the margin to the correct width for others ***/
.clear {
clear: both;
margin: 0;
padding: 0; }
#contents {
background-color: #233622;
margin: 8px 149px 5px 10px;
/*margin-right: 149px;
margin-left: 10px;*/
color: #eef7e2;
padding: 3px 3px 15px 3px;
position: relative; } /*** IE6 needs this to display the div ***/
#footer {
background: #f0f1f0;
margin-top: 1.5em;
margin-right: 139px;
border-top: 1px dashed #888; }
-->
</style>
A hash (or pound or octothorpe) is used to target an ID in HTML:
#pagetitle matches ... <something id="pagetitle"> ...
A full stop is used to target a CLASS in HTML:
.altcolor matches ... <something class="altcolor"> ...
Delete any hashes or full stops and you'll break the styles.
Copy everything inside <!-- and --> and save it into a separate file with a .css extension. Put this in the <head> section of your HTML:
<link rel="stylesheet" href="mycssfile.css" type="text/css">