Solved

CSS override in-line background style?

Posted on 2008-10-08
2
821 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

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

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

that overwrites the inline...
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

726 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