Merging CSS
This tutorial will show you how to correctly merge CSS. CSS is frequently used in overrides and journal styles, and is mostly seen between <style> tags.
CSS (Cascading Style Sheets) is inserted into the <head> section of an html document to tell certain things to do things. Hyperlink rollover effects for example, are done using CSS.
Combining the CSS in an html document is relatively easy once you get the hang of it. I will do a simple example first.
Say you have two different <style> attributes for hyperlinks: one for a background color, and one for the cursor:
<style type="text/css">
<!--
a:hover {
background:black;
}
-->
</style>
<style type="text/css">
<!--
a:hover {
cursor:crosshair;
}
-->
</style>
Those two CSS snippets would make the hyperlinks have a black background, with the cursor changing to a crosshair when you hover over it. However, you can merge these two attributes together into one a:hover attribute:
<style type="text/css">
<!--
a:hover {
background:black;
cursor:crosshair;
}
-->
</style>
All that entailed, was putting the two a:hover attributes into one a:hover attribute within a style tag. If you have two codes that effect the same thing, you can combine them into one.
Now, on with something more complicated. If you have CSS that looks like this:
<style type="text/css">
<!--
a:hover {
background:black;
}
-->
</style>
<style type="text/css">
<!--
body,td,p {
cursor:ne-resize;
}
-->
</style>
All you have to do here, is put it in the next line, so it looks like this:
<style type="text/css">
<!--
a:hover {
background:black;
}
body,td,p {
cursor:ne-resize;
}
-->
</style>
Now. If you have something like
this, wherein you have a scrollbar code, and a background image code, they both use CSS
body tags. All you have to do, is put them in the same
body tag.
<style type="text/css">
<!--
body {
scrollbar-arrow-color:#003399;
scrollbar-track-color:#003399;
scrollbar-face-color:#003399;
scrollbar-highlight-color:#003399;
scrollbar-3dlight-color:#003399;
scrollbar-darkshadow-color:#003399;
scrollbar-shadow-color:#003399;
}
-->
</style>
<style type="text/css">
<!--
body {
background-image:url(http://url.jpg);
background-repeat:no-repeat;
background-position:top left;
background-attachment:fixed;}
-->
</style>
Just merge them to look like this:
<style type="text/css">
<!--
body {
scrollbar-arrow-color:#003399;
scrollbar-track-color:#003399;
scrollbar-face-color:#003399;
scrollbar-highlight-color:#003399;
scrollbar-3dlight-color:#003399;
scrollbar-darkshadow-color:#003399;
scrollbar-shadow-color:#003399;background-image:url(http://url.jpg);
background-repeat:no-repeat;
background-position:top left;
background-attachment:fixed;}
-->
</style>
After you merge all your codes, you should only have
ONE <style> tag in your html document. This is very useful if you manage a lot of overrides on your journal.
For example, here is some merged CSS:
<style type="text/css">
<!--
body {
background-image:url(http://url.jpg);
background:attachment:fixed;
}table {
border:1px solid #C0C0C0;
width:50%;
}a {
color:#000000;
text-decoration:underline;
font-weight:bold;
font-style:italic;
}a:hover {
filter:flpih blur alpha(opacity=20);
height:0;
text-decoration:overline;
}body,td,p,div {
font-family:verdana;
font-size:8pt;
color:#000000;
}-->
</style>
If you have any questions about this tutorial, please
submit a support request under the customization category.