Solved

CSS override in-line background style?

Posted on 2008-10-08
2
780 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now