Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 2004 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

[CSS] What kind of syntax do you use?

Thread title: [CSS] What kind of syntax do you use?
Closed Thread  
Page 2 of 4 < 1 2 3 4 >
    Thread tools Search this thread Display Modes  
10-31-2007, 03:05 AM
#11
unr is offline unr
Status: Member
Join date: Oct 2007
Location: Ontario
Expertise:
Software:
 
Posts: 371
iTrader: 4 / 100%
 

unr is on a distinguished road

Send a message via MSN to unr

  Old

Pure AV,
your Second scheme does make sense,

But, I don't beleive in that sense. :P

I just think that, if all the fonts are there, you should do it in one line, which is allowed in css! :O


Code:
.p
{
        font: verdana, 12px, bold;
/*or*/

        margin: 0 0 10px 11px;
}
Stuff like that's always a must. :P

10-31-2007, 04:17 AM
#12
Andrew R is offline Andrew R
Status: Request a custom title
Join date: Dec 2005
Location: Arizona
Expertise:
Software:
 
Posts: 5,200
iTrader: 17 / 95%
 

Andrew R is on a distinguished road

  Old

Originally Posted by Salathe View Post
I use CSS, it's all the same syntax! As for laying out the styles, I'd have to say "none of the above".
Psh, semantics.

10-31-2007, 05:12 AM
#13
Lance... is offline Lance...
Lance...'s Avatar
Status: Member
Join date: Jun 2007
Location: East Yorkshire, England
Expertise:
Software:
 
Posts: 112
iTrader: 1 / 100%
 

Lance... is on a distinguished road

Send a message via MSN to Lance...

  Old

Originally Posted by unr View Post
Pure AV,
your Second scheme does make sense,

But, I don't beleive in that sense. :P

I just think that, if all the fonts are there, you should do it in one line, which is allowed in css! :O
Lol well erm...I never said anything about fonts. I just showed width/height and padding/margin. I do know shorthand css but that wasn't my point

Perhaps this example is more understandable:

Code:
.coolExample {
          width: 10px; height: auto;
          margin: 0 1px 0 1px; padding: 0 0 5px 0;
          line-height: 20px; letter-spacing: 2px; }
You see? The idea is to put similar attributes on the same line wether they are shorthand or not

Peace, Lance

10-31-2007, 05:49 AM
#14
CreativeLogic is offline CreativeLogic
CreativeLogic's Avatar
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
 
Posts: 1,078
iTrader: 6 / 100%
 

CreativeLogic is on a distinguished road

Send a message via MSN to CreativeLogic

  Old

Originally Posted by LJR View Post
HTML Code:
.class
{
	selector: value;
}
FTW.
Agreed. I code PHP in this way as well, it makes things much easier to read for me. Once you start using your decided 'coding standard' it's hard to move away from it.

If you have a huge block of code within curly braces (especially common in php ifs) then its much easier to distinguish between the start and end of the braces.

10-31-2007, 11:21 AM
#15
Wildhoney is offline Wildhoney
Wildhoney's Avatar
Status: Request a custom title
Join date: Feb 2006
Location: Nottingham
Expertise:
Software:
 
Posts: 1,648
iTrader: 18 / 95%
 

Wildhoney is on a distinguished road

Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney

  Old

The indent styles all have names, I use the Allman style which is like:

Code:
.class
{
	selector: value;
}

10-31-2007, 01:10 PM
#16
danmoore is offline danmoore
Status: I'm new around here
Join date: Oct 2007
Location: Perth, Western Australia
Expertise:
Software:
 
Posts: 18
iTrader: 0 / 0%
 

danmoore is on a distinguished road

  Old

I've taken to writting CSS like

Code:
.class { selector: value; selector: value; selector: value; selector: value; }
I've found it much more manageable when it comes time to make amendments to the code. I can scan the page and look down the line for the exact class I'm after.

I've had comments on it before, mainly people thinking its a little odd. But i find it a lot easier to build, read, amend, and structure.

.meh { }

10-31-2007, 01:13 PM
#17
Garyrae is offline Garyrae
Status: Request a custom title
Join date: Dec 2005
Location: Colchester, UK
Expertise:
Software:
 
Posts: 4,625
iTrader: 16 / 100%
 

Garyrae is on a distinguished road

Send a message via MSN to Garyrae Send a message via Skype™ to Garyrae

  Old

Code:
.class {
	selector:value;
}

10-31-2007, 02:28 PM
#18
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

Originally Posted by Andrew R View Post
Psh, semantics.
Hehe, sorry Andrew.

As for laying out my CSS, I'm quite often very, very anal about everything being precise. It goes far beyond indentation! Everything has to be neat and tidy, well ordered and clear even at a glance. Commenting discrete groups of styles and applying a logical structure to the CSS stylesheet as a whole is important. I'll even make sure to keep the declarations in alphabetical order by property. (That means 'background' comes before 'font' which comes before 'margin')

To unr who posted font: verdana, 12px, bold;, please make sure to read up on the order of the values and indeed how to write those values for the font property.

10-31-2007, 02:42 PM
#19
Joe is offline Joe
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
 
Posts: 2,297
iTrader: 0 / 0%
 

Joe is on a distinguished road

  Old

Code:
.blah {
    something: else;}

.halb {
    gnihtemos: esle;}

10-31-2007, 03:19 PM
#20
Haris is offline Haris
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 2,741
iTrader: 9 / 100%
 

Haris is on a distinguished road

  Old

I use the Allman's style.

It's neat and tidy.

Salathe gave a nice new tip (all selectors in alphabetical order). I wish I could give him some kind of extra reputation for that.

And to keep my style sheet more neat, I tend to place all related selectors in one line. Example:

HTML Code:
#box h2
{
	font-size: 12px; font-weight: normal;
	text-decoration: underline; text-align: center;
}

Closed Thread  
Page 2 of 4 < 1 2 3 4 >


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed