Loading external content into CSS-Element?

N

Nils Weisensee

Hello!

I have a simple CSS-layout at http://home.arcor.de/nilsweisensee/nebendrin/
which doesn't quite do what I want :)

I would like to load different content into the CSS-element "main", which
currently displays the long text, when I click on a different item on the
menu on the left. Right now the text is part of index.html, but I would
like to replace it with the content of a different html-file, just like I
currently do it with frames at www.nebendrin.de

Can somebody tell me how to do this with CSS? Of course I could link the
menu items to completely different html-files that contain all of the
elements my index.html consists of. But that would mean that I would have
to edit all my files everytime I want to change the menu - because all of
the html-files would need to include the whole page-layout.

Does that make sense? :)

In the end, I'm looking for a way to use the CSS-element "main" like a
separate frame whose content is loaded by clicking on the menu.

Would be great if somebody had a tip for me :)

thx & bye
NilS
 
S

Steve Pugh

Nils Weisensee said:
I have a simple CSS-layout at http://home.arcor.de/nilsweisensee/nebendrin/
which doesn't quite do what I want :)

I would like to load different content into the CSS-element "main", which
currently displays the long text, when I click on a different item on the
menu on the left. Right now the text is part of index.html, but I would
like to replace it with the content of a different html-file, just like I
currently do it with frames at www.nebendrin.de

Can somebody tell me how to do this with CSS?

You can't.
Of course I could link the
menu items to completely different html-files that contain all of the
elements my index.html consists of. But that would mean that I would have
to edit all my files everytime I want to change the menu - because all of
the html-files would need to include the whole page-layout.

Either use some form of server side include, or use a pre-processor or
similar to create the pages.

Steve
 
R

rf

Nils Weisensee said:
I would like to load different content into the CSS-element "main", which

You mean the HTML element main. There is no such thing as a CSS element.
Can somebody tell me how to do this with CSS? Of course I could link the
menu items to completely different html-files that contain all of the
elements my index.html consists of. But that would mean that I would have
to edit all my files everytime I want to change the menu - because all of
the html-files would need to include the whole page-layout.

Does that make sense? :)

Yes, sort of, but you have it the wrong way round. You should be including
(somehow) the menu in all the files.

http://allmyfaqs.com/faq.pl?Include_one_file_in_another
 
T

theo

Another cheep and painless alternative would be a frame or an iframe, to
import content into your page.

theo
 
R

Richard

I have a simple CSS-layout at
http://home.arcor.de/nilsweisensee/nebendrin/
which doesn't quite do what I want :)
I would like to load different content into the CSS-element "main",
which
currently displays the long text, when I click on a different item on
the
menu on the left. Right now the text is part of index.html, but I would
like to replace it with the content of a different html-file, just like
I
currently do it with frames at www.nebendrin.de
Can somebody tell me how to do this with CSS? Of course I could link
the
menu items to completely different html-files that contain all of the
elements my index.html consists of. But that would mean that I would
have
to edit all my files everytime I want to change the menu - because all
of
the html-files would need to include the whole page-layout.
Does that make sense? :)
In the end, I'm looking for a way to use the CSS-element "main" like a
separate frame whose content is loaded by clicking on the menu.
Would be great if somebody had a tip for me :)
thx & bye
NilS


Something like this?

http://somestuff.batcave.net/

I use this little script to show and hide divisions as needed.

var kid = "FirstOn"
function ShowInfo(DivId)
{
document.getElementById(kid).style.display = 'none';
document.getElementById(DivId).style.display = 'block';
kid = DivId;
}

<div id="Firston" style="display:block;">
Text
</div>

<div id="sample1" style="display:none">
Text
</div>

Whenever you want to show either divsion, simply use an onclick routine to
show it.
Now to avoid those that turn off JS, find a method to do the same thing in
PHP.
 
L

Leif K-Brooks

theo said:
Another cheep and painless alternative would be a frame or an iframe, to
import content into your page.

Another cheap alternative to what? How is anyone supposed to know what
you're replying to if you don't quote it?

And frames are only painless in the same sense that getting your face
removed with a chainsaw is painless. Even if you ignore the bad results
with search engines, the poor usability, and the inability to print in
many browsers, there's _still_ the unbookmarkability to deal with.

Of course, that's always fixable by using a server-side script to
generate the framesets and using target="_top" for all links -- at which
point you're already using a server-side script and losing the benefits
of frames, so you might as well just use server-side including techniques.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top