LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   CSS - Is there a way to put several lines of HTML into one line using CSS? (https://www.linuxquestions.org/questions/programming-9/css-is-there-a-way-to-put-several-lines-of-html-into-one-line-using-css-690548/)

Chronothread 12-14-2008 02:03 PM

CSS - Is there a way to put several lines of HTML into one line using CSS?
 
I've got a website set up which has a section which is just a bunch of links on the side. But this section of links is on every page of the website. And when I expand and add more links I don't want to have to go to every page and add the new link. Is there a way that I could put all the links into something on CSS (or anything else) that I could just include one line in the HTML? So that when I add a link I'll only have to edit the one file and and then every page will be updated?

Thanks for your time.

jcookeman 12-14-2008 02:16 PM

You cannot do this with CSS as it is not designed for content. You can use either webserver technology such as SSI or something dynamic like JSP includes.

If you want to stick with something more static, then JavaScript is probably your only option. Personally, I would go with something more dynamic.

jay73 12-14-2008 02:32 PM

Ignore, I had not noticed that your content appears to consist of hyperlinks...

Chronothread 12-14-2008 02:36 PM

Thanks for the quick reply.

And there's no way I can just have a separate HTML file that I could somehow call or something from another HTML file? And it would just include whatever is in the called HTML file where it's "called" at?

I'm using space provided to me by the University I'm attending and I don't believe they allow for SSI.

Thanks for your help.

jcookeman 12-14-2008 02:47 PM

Quote:

Originally Posted by Chronothread (Post 3375371)
Thanks for the quick reply.

And there's no way I can just have a separate HTML file that I could somehow call or something from another HTML file? And it would just include whatever is in the called HTML file where it's "called" at?

I'm using space provided to me by the University I'm attending and I don't believe they allow for SSI.

Thanks for your help.

CSS is used by the client to define the presentation of the content. In order to actively change the content, you will have to use server side technology. You can use a dynamic menu written in JavaScript, but this is client-side technology.

You can use an IFRAME, but this is not supported by XHTML 1.0 or HTML 4.1 Strict.

Chronothread 12-14-2008 03:17 PM

Ok, I'll see what I can do then.

Thanks much for the information.

i92guboj 12-14-2008 05:13 PM

I'd just use php for this. Maybe your server supports that (most do nowadays). You can create a separate php file with the menu, or whatever, then just include it from your main php file(s).

addic 01-04-2011 05:38 PM

Quote:

Originally Posted by Chronothread (Post 3375371)
Thanks for the quick reply.

And there's no way I can just have a separate HTML file that I could somehow call or something from another HTML file? And it would just include whatever is in the called HTML file where it's "called" at?

I'm using space provided to me by the University I'm attending and I don't believe they allow for SSI.

Thanks for your help.

i'm thinking...and this hasn't been tested..but uh did you try using the bg image tag to call the file? it looks something like this in the css script...

background-image: url(/resources/pictures/35663ai.gif);

dugan 01-04-2011 05:43 PM

I'd just use a content management system for this. That's what they're for. I recommend Wordpress.

If you can't install a CMS, then an alternative is to use a templating engine:

http://wiki.python.org/moin/Templating

Here's one popular templating engine you can use:

http://www.makotemplates.org/

Tinkster 01-04-2011 06:04 PM

OP ...

Silly question - are you just trying to keep a navigation section on
the page at all times? If so, that can certainly be achieved w/ css
and a plain (single) HTML file.


Cheers,
Tink

Tinkster 01-04-2011 06:04 PM

*sigh*
another network induced axidupe :/

addic 01-05-2011 05:33 AM

Quote:

Originally Posted by Tinkster (Post 4213328)
OP ...

Silly question - are you just trying to keep a navigation section on
the page at all times? If so, that can certainly be achieved w/ css
and a plain (single) HTML file.


Cheers,
Tink

I'm not sure about chondeau but, me, ironicly yeah, but the problem isn't seperating the code its re-implimenting it into the file...should we do it your way, which sounds good, what's the line to throw it back into the given webpage.

On a side note: i 'm not using php (cuz I haven't leaned it yet) so I'm tryna figure out if I can use js to call the navigation and have it edit the code based on what page is loading. I guess something like: if - <ttitle> ="x" then = doc.write. etc etc get it?

And how do most major websites keep the navi with the other pages? (If I said that correctly)

bigearsbilly 01-05-2011 06:06 AM

I did a similar thing by making a quick templating tool in perl and make
which generates a website from templates.
I stuck my menu and logo on every page.
there may be proper tools to do this.

you can do it with js yes.
there are plenty of free CSS menu and js menu sites out there.
try cssplay.

a lot of CMS tools need an RDBMS as well, which may or may not be available
on your host.

you could try SSI maybe?


All times are GMT -5. The time now is 06:26 AM.