Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Old 05-21-2008, 06:26 PM !important;
Banned

Posts: 9
Name: BlakeTallos
Location: Cuyahoga falls,Ohio
Trades: 0
Quote:
<style>
html body.bodyContent table tbody tr td table.friendsComments{
width: 770px !important;
margin: 0 !important;
padding: 0 !important;
margin-top: 20px !important;
overflow: hidden !important;
background-color: transparent !important;
margin-left: -1px !important;

_width: 770px !important;
_margin-left: -2px !important;
}
when you see something like !important;
is that just basically making a comment ??

will that work like a comment

html comment code is <!--html-->

and css comment code is

/* This is a comment */


But can we use !important; instead??
BlakeAnthony is offline
Reply With Quote
View Public Profile Visit BlakeAnthony's homepage!
 
 
Register now for full access!
Old 05-21-2008, 08:44 PM Re: !important;
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
when you see something like !important;
is that just basically making a comment ??
No, it's not a comment, it's a HACK and for the most part there is no reason to use it if your code is written correctly.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-21-2008, 09:41 PM Re: !important;
Banned

Posts: 9
Name: BlakeTallos
Location: Cuyahoga falls,Ohio
Trades: 0
Oh i see well now i know!! There was a Website that i saw and all i saw were !important; "Hacks"

I was like woah that's not normal so i had to bring it Up!!
people usually do those to Make there Code to Align Properly with the browser there using right ?
BlakeAnthony is offline
Reply With Quote
View Public Profile Visit BlakeAnthony's homepage!
 
Old 05-22-2008, 04:51 AM Re: !important;
Super Moderator

Posts: 1,584
Location: Kokkola, Finland
Trades: 1
Quote:
Originally Posted by LadynRed View Post
No, it's not a comment, it's a HACK and for the most part there is no reason to use it if your code is written correctly.
are you SURE itīs a hack? how does it fit your definition of a hack? iīve seen eric meyer use it in one of his books, and it can be useful when used with caution in regard to a userīs possible own stylesheet setup.
davemies is offline
Reply With Quote
View Public Profile Visit davemies's homepage!
 
Old 05-22-2008, 08:21 AM Re: !important;
Kirtan's Avatar
Who Am I?

Posts: 376
Name: Venkat Raj
Location: Salem, South India
Trades: 3
Its NOT a Hack, not even a Filter. Its a valid DECLARATION. Of course, you can use it as hack/filter. http://www.w3.org/TR/REC-CSS2/cascad...mportant-rules
__________________
All the Buddhas of all the ages have been telling you a very simple fact: Be -- don't try to become.
Kirtan is offline
Reply With Quote
View Public Profile Visit Kirtan's homepage!
 
Old 05-22-2008, 09:44 AM Re: !important;
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
It is most often USED as a hack and, yes, it has it's place, but I have never found the need to use it - not once. I have a colleague, however, who does use it, and he uses it most often because he doesn't get his specificity correct. I've been able to remove it in every single instance where he used it, replacing it with more specific coding.

Quote:
people usually do those to Make there Code to Align Properly with the browser there using right ?
Nope, they use it for all kinds of things.

Oh.. and this is one of my pet peeves..
there = a place
their = is a possessive pronoun. It always describes a noun ie. "it's THEIR apartment".
they're - contraction for "they are"
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 05-22-2008, 02:37 PM Re: !important;
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Whenever I add an !important tag to my code, I feel the gloom and doom of the finality it suggests. Handle with care, as it overrides many good and natural things in a stylesheet, such as the specificity. The !important tag can also be used to override inline styles, which is sometimes useful, but also tricky. If you have complete control over your HTML, I believe it is a good thing to never have inline styles. Sometimes this is not the case, and it is then useful to be able to override these styles with !important.

As stated previously in this thread, !important is usually used as a hack, as IE6 has a serious misunderstanding of it. For example:
Code:
#element {
margin: 100px !important;
margin: 0;
}
All the standard browsers will understand that #element has a margin of 100px, because although it appears first in the order, it has the !important tag on it. However, IE6 thinks that because the margin: 0 comes second, it is dominant. This is a way of sending a special message to IE6 in a single CSS document that will pass validation if you need it to. Of course there are many ways to do this...
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-22-2008, 06:28 PM Re: !important;
Arenlor's Avatar
Ultra Talker

Posts: 462
Name: Jerod Lycett
Location: /home/arenlor
Trades: 0
This is quite interesting, never heard of this before, though even if there was a time when I needed to use it I couldn't do it, ! is set in my mind as not. Do they realize this? I only see this as useful when I'm making a user style-sheet and want to win the war.
__________________
PHP Code:
<?php echo "Hello World"?>
HTML Code:
<html><head><title>Hello World</title></head><body><p>Hello World</p></body></html>
Arenlor is offline
Reply With Quote
View Public Profile Visit Arenlor's homepage!
 
Old 05-22-2008, 08:47 PM Re: !important;
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I have been working late, and just used the !important remark twice in a row. I remembered this thread, and it just occurred to me a correct usage for this item.

I have a class, which I call 'inviz'. All it does is make an item invisible. It functions like this:
Code:
.inviz {
position: absolute !important;
left: -9999px !important;
}
The reason I specify it this way is the way this class is used: dynamically. In other words, I am using Javascript to place this class (or remove it) from various elements on the page, thereby hiding them or revealing them in real time.

The easiest and best way to create this class is with the !important tag, because it overrides the specificity. Often, you must be careful about overriding specificity, because it is an important element in CSS structure, but in this case, it is exactly what I want. If I place this class on an element, I want it to be the most powerful class on the div, p, or whatever I want to make invisible. I don't want position of relative, for example to take precedence over my absolute, just because it is more specific. Also, I don't want to make a specific rule for each case where 'inviz' might be needed, because that would be too much work. Time is money.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is online now
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to !important;
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.79160 seconds with 12 queries