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
Setting same border attributes on 3 sides and border:none on one side
Old 10-17-2011, 07:44 PM Setting same border attributes on 3 sides and border:none on one side
MattCoops's Avatar
Ultra Talker

Posts: 423
Name: Matt Cupan
Location: Charlotte, NC
Trades: 0
I'm a minimalist when it comes to coding. I loved the idea of shorthand properties when they came out for CSS. And the dismissal of the annoying <doctype> instruction with HTML 5 release.

Anyhow, in the good moral ethics of front-end coding, is it good "juju" to declare all border properties to be the same within CSS styling, and then, right after a semicolon, subtracting a particular border property?

such as:

Code:
border: solid 1px black; border-bottom:none;
__________________
Matt - Tweeting
Please login or register to view this content. Registration is FREE


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

read my
Please login or register to view this content. Registration is FREE
MattCoops is offline
Reply With Quote
View Public Profile Visit MattCoops's homepage!
 
 
Register now for full access!
Old 10-17-2011, 07:51 PM Re: Setting same border attributes on 3 sides and border:none on one side
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
You are better off dropping it down a line for "readability"

But if you really wanted to you could put the entire ruleset on a single line with no spaces at all.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-17-2011, 09:36 PM Re: Setting same border attributes on 3 sides and border:none on one side
MattCoops's Avatar
Ultra Talker

Posts: 423
Name: Matt Cupan
Location: Charlotte, NC
Trades: 0
I just thought it better to code it that way rather than write the same attributes 3 different times for (left,top,right)-border.
__________________
Matt - Tweeting
Please login or register to view this content. Registration is FREE


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

read my
Please login or register to view this content. Registration is FREE
MattCoops is offline
Reply With Quote
View Public Profile Visit MattCoops's homepage!
 
Old 10-18-2011, 12:04 AM Re: Setting same border attributes on 3 sides and border:none on one side
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I'm guessing that evan if you use "border: solid 1px black;" to set all four borders simultaneously, at some point the browser will still have to interpret that and set the value for all four sides one at a time. So, using your example the browser would have to do one extra assignment, meaning slighly longer execution time.

Although, with your example there will obviously also be less text and thereby a slightly smaller file to send over the net.

However, the gains of either case is too small to make any practical difference. So just go with the one you find most aesthetically pleasing
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 10-21-2011, 07:03 AM Re: Setting same border attributes on 3 sides and border:none on one side
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by MattCoops View Post
I just thought it better to code it that way rather than write the same attributes 3 different times for (left,top,right)-border.
Sure but what I was meaning was:

Code:
.class {
     border: solid 1px black;
     border-bottom: none;
}
Makes it a little more "readable" when debugging or making modifications.
the rules would still work if you set it out as;
Code:
.class{border:solid 1px black;border-bottom:none;}
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Setting same border attributes on 3 sides and border:none on one side
 

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