Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4567346
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:55:02+00:00 2026-05-21T18:55:02+00:00

I have a css file which, for organizational sake, is in another directory from

  • 0

I have a css file which, for organizational sake, is in another directory from the one where the images are. The thing is I always end up setting all the background-images like this: background-image: url(../img/Untitled.jpg).
There’s anything like the HTML’s <base> tag that can be used in css so I don’t need to put that “../img/” to every single background-image?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:55:04+00:00Added an answer on May 21, 2026 at 6:55 pm

    Another possible option would be to create your css styles using php or another server side language. You can then use a directory variable to spit out the full path for each item.


    styles.php

    <?php
        header("Content-Type: text/css");
        $imageDir='../images';
        // or
        // $imageDir='/newsletter/2010/jan/17/business/category/7/img';
    ?>
    
    .divClass{
        background : url('<?php echo $imageDir; ?>/kitten.jpg');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've so far made a html and css file which have three images; title,
I have one freemarker template file which loads all css and js files used
I have a page (page1.html) which references a css file (style1.css) All is good.
Are .css files always needed? Or may I have a .css basic file and
I have written a CSS sprite auto-generator which takes selected images out of the
I have an external CSS file which defines the style for the Button tag.
I have css file reference in my website which is shown as below: <link
I have the following style in an external CSS file called first.css table {
In firefox, I have the following fragment in my .css file tree (negative){ font-size:
I have the following file: <html> <head> <title></title> <link rel=css type=text/css href=/empty.css title=css />

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.