Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-06-11 16:39:59

stef25
Member
Registered: 2005-12-26
Posts: 88

How do i link to images in a stylesheet?

how do i link to images from my css file? I mean images like icons and backgrounds, not images associated with articles

txp is installed at domain.com/new and images are in domain/com/new/img

when i use background: url (img/file.jpg) it doesnt work but when i put the full domain it does. i would rather not upload these images via txp into the txp database.

does that mean i have to use the full url?


I need someone to protect me from all the measures they take in order to protect me

Offline

#2 2006-06-11 17:32:39

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: How do i link to images in a stylesheet?

Assuming you are using the Textpattern styles editor for your CSS, the URL of your stylesheet should be:

<pre>www.domain.com/new/textpattern/css.php?</pre>

All references to images should be relative to that location. The way things are now, Textpattern is looking for your images at <code>domain.com/new/textpattern/img/file.jpg</code> and obviously, that doesn’t work.

Try <code>../img/file.jpg</code> instead.

Last edited by Elenita (2006-06-11 17:34:01)

Offline

#3 2006-06-11 18:32:05

jdykast
Member
From: Tennessee
Registered: 2004-12-30
Posts: 119
Website

Re: How do i link to images in a stylesheet?

Here is an example of mine:

Stylesheet link:
<code><link rel=“stylesheet” href=“http://www.siteurel.com/textpattern/css.php?n=default” type=“text/css” /></code>

Stylesheet code:
<code>#myDiv { background: #fff url(/images/4.gif) no-repeat top right;}</code>

I’ve stored my images using Textpattern’s image handling so they have been renamed according to their id numbers. You won’t be able to use the names (to my knowledge) if you’ve uploaded them using Textpattern.

Offline

#4 2006-06-11 18:44:53

stef25
Member
Registered: 2005-12-26
Posts: 88

Re: How do i link to images in a stylesheet?

thank you elenita, that worked


I need someone to protect me from all the measures they take in order to protect me

Offline

Board footer

Powered by FluxBB