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 10-19-2008, 11:07 AM CSS best practices
Jessemn's Avatar
Experienced Talker

Latest Blog Post:
Horsetail Firefall (pic)
Posts: 44
Location: K-W, Canada
Trades: 0
Is it considered bad practice to to have ANY style items outside of my css files?

For instance - I have, say, <span class="error" style="margin:10px 10px">. Simply because I have a spot where I want one specific error message to display a little differently. Does this look unprofessional? Should I create an "error2" class for this?
__________________

Please login or register to view this content. Registration is FREE
- Promote Your Blog!
Jessemn is offline
Reply With Quote
View Public Profile Visit Jessemn's homepage!
 
 
Register now for full access!
Old 10-19-2008, 01:17 PM Re: CSS best practices
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Inline styles are rarely necessary, and it will be cleaner to put those inline styles in an external CSS file. You CAN apply more than one class to an element. So put that 'extra' styling in a separate class and combine the classes - like this:

.error2{margin: 10px;}
<span class="error error2">
__________________
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 10-19-2008, 04:41 PM Re: CSS best practices
Extreme Talker

Posts: 188
Trades: 0
Its not 'wrong' it will still validate but as ladynred said its not really needed.

Suppose its a matter of opinion, as long as it validates it does not bother me how the coder has done it.
__________________

Please login or register to view this content. Registration is FREE
twiggy is offline
Reply With Quote
View Public Profile Visit twiggy's homepage!
 
Old 10-19-2008, 05:16 PM Re: CSS best practices
Average Talker

Posts: 29
Name: Taylor
Trades: 0
The only time I use inline style is when i use JavaScript to change the style...
Raisdead is offline
Reply With Quote
View Public Profile
 
Old 10-21-2008, 09:32 PM Re: CSS best practices
Jessemn's Avatar
Experienced Talker

Latest Blog Post:
Horsetail Firefall (pic)
Posts: 44
Location: K-W, Canada
Trades: 0
Quote:
Originally Posted by LadynRed View Post
Inline styles are rarely necessary, and it will be cleaner to put those inline styles in an external CSS file. You CAN apply more than one class to an element. So put that 'extra' styling in a separate class and combine the classes - like this:

.error2{margin: 10px;}
<span class="error error2">
Ahhh, I didn't know I could combine classes like that! Thanks for the help.
__________________

Please login or register to view this content. Registration is FREE
- Promote Your Blog!
Jessemn is offline
Reply With Quote
View Public Profile Visit Jessemn's homepage!
 
Reply     « Reply to CSS best practices
 

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.21530 seconds with 12 queries