|
|
|
|
Thread title: [CSS] What kind of syntax do you use? |
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
10-31-2007, 03:05 AM
|
#11
|
Status: Member
Join date: Oct 2007
Location: Ontario
Expertise:
Software:
Posts: 371
|
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
|
Status: Request a custom title
Join date: Dec 2005
Location: Arizona
Expertise:
Software:
Posts: 5,200
|
Originally Posted by Salathe
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
|
Status: Member
Join date: Jun 2007
Location: East Yorkshire, England
Expertise:
Software:
Posts: 112
|
Originally Posted by unr
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
|
Status: Request a custom title
Join date: Feb 2005
Location:
Expertise:
Software:
Posts: 1,078
|
Originally Posted by LJR
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
|
Status: Request a custom title
Join date: Feb 2006
Location: Nottingham
Expertise:
Software:
Posts: 1,648
|
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
|
Status: I'm new around here
Join date: Oct 2007
Location: Perth, Western Australia
Expertise:
Software:
Posts: 18
|
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
|
Status: Request a custom title
Join date: Dec 2005
Location: Colchester, UK
Expertise:
Software:
Posts: 4,625
|
Code:
.class {
selector:value;
}
|
|
10-31-2007, 02:28 PM
|
#18
|
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
Posts: 3,820
|
Originally Posted by Andrew R
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
|
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
Posts: 2,297
|
Code:
.blah {
something: else;}
.halb {
gnihtemos: esle;}
|
|
10-31-2007, 03:19 PM
|
#20
|
Status: Request a custom title
Join date: Dec 2005
Location:
Expertise:
Software:
Posts: 2,741
|
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;
}
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|