override part of css

  • Thread starter Chris Kouwenhoven
  • Start date
C

Chris Kouwenhoven

Hello,

I'm using an external css-file which contains BODY elements.
In one certain page i want to overrule the background-color properties, but
the functions as getElementByTags of byId does not work

any suggestions?

kind regards,
Chris
 
F

Fred Basset

Let me first make sure I understand what you mean. I believe you mean
that you have a generic link in your pages to an external stylesheet,
along the lines of ...

<link rel="stylesheet" href="style.css" type="text/css">

... and that it's presumably somewhere in the head. You now want to
override the background colour of something. I'm not sure whether you
mean the actual BODY tag, or just some tags within the body.

If you mean the body then all you have to do is after you've put the
external stylesheet link, put this in your head.

<style type="text/css">
body { Background: red; }
</style>

This will overwrite the stylesheet's body background property, but not
the rest of them.

If you are wanting to change other elements then I'm not sure how you
wish to change them. If you have for example ...

<input type="button" class="buttonclass">

... and you want to overwrite the background colour, then all you have
to do is add in a style attribute.

<input type="button" class="buttonclass" style="Background: red;">

Hope this helps, if not then I'm afraid I've misunderstood your request.


Fred Basset
(e-mail address removed)
 
D

David Dorward

Chris said:
I'm using an external css-file which contains BODY elements.
In one certain page i want to overrule the background-color properties,
but the functions as getElementByTags of byId does not work
any suggestions?

I suggest you show us the code that doesn't work, in context (this means
provide a URI, not a bunch of code pasted in to the post) and tell us what
enviroment (browsers, OS) you tested it in.

Its very difficult to tell what's going wrong when you only give us partial
function names that you tried to use!
 
C

Chris Kouwenhoven

Perfect, Fred

this is the solution, you understand the problem right.

weird, that sometimes the solutions are so easy :)

Thanks a lot!

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top