Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CSS override in-line background style?

Posted on 2008-10-08
2
Medium Priority
?
859 Views
Last Modified: 2012-05-05
I am maintaining a web site, but it's built using pre-defined templates and I want to change the background image in the "contentheader" div container. The html looks like this:

<div id="contentheader" style="background-image:url('/global/images/background/image.jpg')">
  <div>some content</div>
  <div>some more content</div>
</div>

I can edit the CSS page that is used for this page, but I think the in-lins style tag would over-ride anything I added in the CSS file.

Is there a way to add a style attribute in a CSS page and then force it to ignore in-line attributes?

I would do this in Javascript but I need it to apply to all apges on the site and I don't want to edit them all manually.

Thanks. I know someone has an answer... :)
0
Comment
Question by:jopie916
2 Comments
 
LVL 3

Accepted Solution

by:
DerkArts earned 2000 total points
ID: 22674010
in your ccs file:

#contentheader{
  background-image:url(/your/image.jpg') !important;
}

that overwrites the inline...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question