473,811 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Style Sheet Woes

I am working on a website that is using a Cascading Style Sheet. I've
created the primary webpages and .css page. The format is the same
throughout the entire website EXCEPT the color of the headings and
hyperlinks.

I need to make each site have a different color of those items. How do
I make the changes to each page, but keep the same .CSS?

Any feedback would be GREATLY appreciated!

Jul 24 '05 #1
4 1833
Els
Wintersrush wrote:
I am working on a website that is using a Cascading Style Sheet. I've
created the primary webpages and .css page. The format is the same
throughout the entire website EXCEPT the color of the headings and
hyperlinks.

I need to make each site have a different color of those items. How do
I make the changes to each page, but keep the same .CSS?

Any feedback would be GREATLY appreciated!


By giving each page a different id or class.
Let's say you have a blue and a red page.
Page one's HTML:
<body class="one">
Page two's HTML:
<body class="two">

CSS for both pages:
body.one h1,
body.one a{
color:blue;
}
body.two h1,
body.two a{
color:red;
}

Obviously these styles aren't complete, but you get the idea.

--
Els http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
Now playing: Thunder - Love Walked In
Jul 24 '05 #2
Wintersrush wrote:
I am working on a website that is using a Cascading Style Sheet. I've
created the primary webpages and .css page. The format is the same
throughout the entire website EXCEPT the color of the headings and
hyperlinks.

I need to make each site have a different color of those items. How do
I make the changes to each page, but keep the same .CSS?

I am a little unclear if you want each *site* to be different, or each
*page*. Or both?
Create one CSS file that contains all of the common styles. Then for
each site have a separate file with that site's unique styles. The <head>
would have two @import's (or <link rel=...>), one for each file.
For each page the idea Els suggested is good.
How many pages does the site have? It must not be very many. If there
are a lot, and you are using a server-side scripting language (like php,
asp), you could randomly select a color as each page is generated.

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Jul 24 '05 #3
Els wrote:

Wintersrush wrote:
I am working on a website that is using a Cascading Style Sheet. I've
created the primary webpages and .css page. The format is the same
throughout the entire website EXCEPT the color of the headings and
hyperlinks.

I need to make each site have a different color of those items. How do
I make the changes to each page, but keep the same .CSS?

Any feedback would be GREATLY appreciated!
By giving each page a different id or class.

[details snipped] Obviously these styles aren't complete, but you get the idea.


This is too complicated and ignores the cascading of style sheets.

Put what is common to all pages in the .css file. Then, in the
HEAD section of each page, first put the link to that .css file and
then have a local style sheet. It should look like this:
<LINK REL=STYLESHEET TYPE="text/css" HREF="genl_styl e.css" >
<style TYPE="text/css">
<!--
[local style declarations go here]
-->
</style>

If anything in the local declarations conflict with the contents of
genl_style.css, the local declarations will prevail. Thus, you get
a cascade. For a summary of the cascade concept, see my
<URL:http://www.rossde.com/internet/Webdevelopers.h tml#css>.

Note: Today, the comment brackets <!-- and --> are often omitted
because the newer browsers all recognize style sheets. I still use
them so that my pages can still be viewed with older browsers.

--

David E. Ross
<URL:http://www.rossde.com/>

I use Mozilla as my Web browser because I want a browser that
complies with Web standards. See <URL:http://www.mozilla.org/>.
Jul 24 '05 #4
"Wintersrus h" <je*****@comcas t.net> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I am working on a website that is using a Cascading Style Sheet. I've
created the primary webpages and .css page. The format is the same
throughout the entire website EXCEPT the color of the headings and
hyperlinks.

I need to make each site have a different color of those items. How do
I make the changes to each page, but keep the same .CSS?


The following example isn't the only way to do it but it's how I do it.

Common styles go in one stylesheet, custom styles in another. Link to the
default stylesheet first and then to the stylesheet for the current site.

eg: if default.css contains h1{color:#FF000 0} /* red */
and page1.css only contains h1{color:#00FF0 0} /* green */
then, using the code snippet below, <h1> would appear as green text.

<link rel="stylesheet " type="text/css" href="Styles/default.css">
<link rel="stylesheet " type="text/css" href="Styles/page1.css">

If you linked to page1.css first then <h1> would appear as red text.
Jul 24 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2017
by: Mark | last post by:
Hi - I want to allow users of an intranet application, to select their own colours etc. So I have a tbale in my database, which has fields called bgcolour, fontcolour etc. As I want all pages to get the users colours, I have an includes file at the top of each page: <!--#include file="userconfig.asp" --> This is:
2
3956
by: Luke Bellamy | last post by:
Hi, I have been looking for a way to incorperate several different style sheets into a web page (i.e cascading effect). I have looked into the @import statement which seems to do what I want but unfortunately restrictions on the architecture may this unfeasible. With the LINK tag I could use that but I understand older browsers dont support it properly. I will only ever have 2 style sheets. Is there a way to link one style sheet to...
7
3060
by: Daniel Kaplan | last post by:
I have the item below at the top of my style sheet. And it seems that the font-szie is ignored. I know that my linked style sheet is being read, and used because if I remove the font-family line, the font changes. But it appears that no matter what I do with the font-size, it is ignored, and I cannot figure out why! Any clues? At the very bottom is the entire style sheet, just incase anyone comes accross something that they feel is...
1
1982
by: Amanda H. | last post by:
I posted about this a few days ago, and I got a few suggestions that fixed part of my problem. I am using a PHP script to switch external style sheets when the viewer clicks on the style link. Search "Amanda H." in this group and you can view my last post to see the original PHP and html junk. This below is the updated link rel and the meta tags. Before, it wouldn't refresh or change in Opera, Firefox, or IE6/Win & IE5/Mac. The...
2
945
by: tjonsek | last post by:
I am familar with using style sheets in plain old HTML or ASP pages. I thought I'd attempt the same in an asp.net app. I am finding something wierd however. I use this line in the <head> tag of the webform: <LINK href="Styles.css" type="text/css" rel="stylesheet" runat="server" /> However, studio.net keeps taking the closing /> out of the line. The style sheet works fine if I make sure the end '/' is there before running the app....
8
41528
by: pamelafluente | last post by:
Hi guys, Is it possible to add "onload" (via Javascript) a new class to the <styleheader section? If yes, how would that be done ? <style type="text/css" media="screen"> .NewStyleClass{ whatever } </style>
10
2690
by: pamelafluente | last post by:
Hi, this time I am trying to add a style on the fly.I wish equivalency with this one (only the menuItemStyle line): <head> <style type="text/css" media="screen"> ... some static styles ... ..menuItemStyle{ background:#ddeeff;border-width:1px;border-style:inset;font-family:Arial;font-size:11px
4
2406
by: fjm | last post by:
Hello everyone. I’d like to know how to handle multiple style sheets. I have css tabs that have a style sheet and then I also have a separate style sheet for the content that goes inside the tab. The problem I am running into is that the tab style sheet uses attributes in the html and body and so does the content style sheet. Each one is specific to its content. The tab style sheet seems to take precedence over the content style sheet because...
4
5636
Frinavale
by: Frinavale | last post by:
So a while ago I created a Tab Strip Control (before the AjaxToolkit had theirs otherwise I would have probably just used theirs). When I looked at the AjaxToolkit control to see how they got around this problem I discovered that they're using Animations. I don't want to bloat my control with the Ajaxtoolkit's Animation stuff though. I guess I should tell you what the problem is. I have a TabStrip custom control. It's a Table that has...
0
9734
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4346
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.