473,385 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Access style by name of external file?

Hi

I build a small content management system. I use different external
stylesheets for the admin section and the frontend, called admin.css and
frontend.css.

Now I would like to preview some frontend stuff in the admin section. Is
there a syntax for accessing a style from a different style sheet? For
example:

admin.css says:
h1 {
color:red;
}
p {
font-family:sans-serif;
}

frontend.css says:
h1 {
color:blue;
}
p {
font-family:serif;
}

in a file admin.html I would like to do something like:

<head>
<link rel="stylesheet" href="admin.css" type="text/css">
<link rel="alternate stylesheet" href="frontend.css" type="text/css">
</head>
<body>
<h1>Red headline</h1>
<p>Some sans serif text here</p>

<div stylesheet="use alternate stylesheet, is that possible?">
<h1>Blue headline</h1>
<p>Some serif text here</p>
</div>

</body>

I am grateful for a hint on that.

--
Markus
Jul 20 '05 #1
2 2232
Markus Ernst wrote:
Hi

I build a small content management system. I use different external
stylesheets for the admin section and the frontend, called admin.css and
frontend.css.

Now I would like to preview some frontend stuff in the admin section. Is
there a syntax for accessing a style from a different style sheet?
Not that I know of, however I'm new to CSS.
For
example:

admin.css says:
h1 {
color:red;
}
p {
font-family:sans-serif;
}

frontend.css says:
h1 {
color:blue;
}
p {
font-family:serif;
}

in a file admin.html I would like to do something like:

<head>
<link rel="stylesheet" href="admin.css" type="text/css">
<link rel="alternate stylesheet" href="frontend.css" type="text/css">
</head>
<body>
<h1>Red headline</h1>
<p>Some sans serif text here</p>

<div stylesheet="use alternate stylesheet, is that possible?">
<h1>Blue headline</h1>
<p>Some serif text here</p>
</div>

</body>

I am grateful for a hint on that.


If you can't find a clean CSS solution, & this is just for internal
previewing, how about duplicating your stlyesheets & then indenting each
line in each such duplicate with something like
..sheet<name>
for some suitable <name>

You can then apply any of those styles by including within an object to
whom you give class sheet<name> & linking to the indented sheets.

If you need to make many changes to the sheets & preview each time, you
could automate generation of the indented sheets with a little bit of
perl or other suitable language.

Maybe you'll get a simpler solution.

--
Michael
m r o z a t u k g a t e w a y d o t n e t
Jul 20 '05 #2
"Michael Rozdoba" <mr**@nowhere.invalid> schrieb im Newsbeitrag
news:3f*********************@lovejoy.zen.co.uk...
Markus Ernst wrote:
Hi

I build a small content management system. I use different external
stylesheets for the admin section and the frontend, called admin.css and
frontend.css.

Now I would like to preview some frontend stuff in the admin section. Is
there a syntax for accessing a style from a different style sheet?


Not that I know of, however I'm new to CSS.
For
example:

admin.css says:
h1 {
color:red;
}
p {
font-family:sans-serif;
}

frontend.css says:
h1 {
color:blue;
}
p {
font-family:serif;
}

in a file admin.html I would like to do something like:

<head>
<link rel="stylesheet" href="admin.css" type="text/css">
<link rel="alternate stylesheet" href="frontend.css" type="text/css">
</head>
<body>
<h1>Red headline</h1>
<p>Some sans serif text here</p>

<div stylesheet="use alternate stylesheet, is that possible?">
<h1>Blue headline</h1>
<p>Some serif text here</p>
</div>

</body>

I am grateful for a hint on that.


If you can't find a clean CSS solution, & this is just for internal
previewing, how about duplicating your stlyesheets & then indenting each
line in each such duplicate with something like
.sheet<name>
for some suitable <name>

You can then apply any of those styles by including within an object to
whom you give class sheet<name> & linking to the indented sheets.

If you need to make many changes to the sheets & preview each time, you
could automate generation of the indented sheets with a little bit of
perl or other suitable language.

Maybe you'll get a simpler solution.

--
Michael
m r o z a t u k g a t e w a y d o t n e t


Thank you for your idea Michael. What I actually did now was a variant of
your solution: I made a separate stylesheet file for the content section and
put all the contents into a div with the id "content". And the styles are
defined as

#content h1 { ... }
#content p { ... }

and so on. So I can import that same stylesheet file into the admin preview
file without affecting the admin-specific definitions of h1 and p and so on.

--
Markus
Jul 20 '05 #3

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

Similar topics

2
by: Ravi | last post by:
My XML looks like: <abc> <def type="apple"> 1 </def> <def type="peach"> 2 </def> <def type="orange"> 3 </def> <def type="banana"> 4 </def> <def type="plum"> 5 </def> </abc>
11
by: George Hester | last post by:
I have a css file this is a portion of it: /* trackaccept.css */ div.track { width:400px; height: 100px; } I have this in my ASP page:
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
3
by: Xerxes | last post by:
Hi, I would like to import the tables from MySQL database into Access database and I am not sure how to go about it. I tired to "Import External Data" from Access, selected "ODBC database" from...
0
by: TheCoder | last post by:
I am making a D-base with web conectivity for my class project. I have everything working but the subit button sends the data to the correct fields but afterwards it wants to reproduce new blank...
4
by: Debbiedo | last post by:
My software program outputs an XML Driving Directions file that I need to input into an Access table (although if need be I can import a dbf or xls) so that I can relate one of the fields...
1
by: Webstorm | last post by:
Hi, I hope someone can help me sort this out a bit, Im completely lost. Here is the page I am working on: http://www.knzbusinessbrokers.com/default.asp I have 3 search critera that I need to...
16
by: Phil Stanton | last post by:
I have a form with a button which is supposed to open an Excel file (With lots of Macros /VBA) in it. The Excel file gets it's data from the Access program Here is the code Private Sub...
4
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.