Solved

CSS override in-line background style?

Posted on 2008-10-08
2
805 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 500 total points
ID: 22674010
in your ccs file:

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

that overwrites the inline...
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
is this a cms? 8 60
CSS Logo Problem. 2 20
SlickNav Menu Plugin Not appearing on mobile 6 32
Make options hidden and show just option that is on 1 12
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

776 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