/    Sign up×
Community /Pin to ProfileBookmark

Need support about CSS !important

Dear All,

I am very new to CSS and HTML. i am facing problem with !important of CSS . Hope some one can help me out.

I have table implmentation , when any row is selected then i add class to the TR with background #00000 !important

as below

.TRColor td
{
background-color : #000000 !important
}

So whole table rows will be set with blank color.

Now my requirement is, i want to set different color for particular cell of a table. When i add different css class to TD, it is not able to show becuae of the !important set at the TR level. Even i create new class with !important still it is not able to display.

Can some one help me on how to resolve this problem.

Best Regards,
Venkat

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@kubasMar 04.2010 — this is javascript forum, so i give you

javascript advice.

loop over all cells and set cell.style.backgroundColor to

what you want

[CODE]var cell = yourTable.cells;
for(i=0; i<cell.length; i++){
if(i&#37;2==0) cell.style.backgroundColor = 'black';
else cell.style.backgroundColor = 'green';
}[/CODE]


sets each second cell to green and black

read:

http://www.w3schools.com/jsref/dom_obj_table.asp
Copy linkTweet thisAlerts:
@venkata_kesavaauthorMar 04.2010 — Thanks for the prompt reply. But we have applied css property with !important so browser will take the css set background color not the one set by JavaScript
Copy linkTweet thisAlerts:
@jumpiest_monkeyMar 04.2010 — Then you need to post this in the CSS forum, not the Javascript forum, buddy!
×

Success!

Help @venkata_kesava spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...