TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-14-2009, 12:44 AM   #21 (permalink)
The Acquainted
 
Randy's Avatar
 
Join Date: May 2007
Location: Your G/F's Closet
Posts: 114
Thanks: 7
Randy is on a distinguished road
Default

I have pretty much a mix of all yours it seems:

PHP:
PHP Code:
if ($a == 1)
{
  if (
$b == 1)
    {
        echo 
'Hello world!';
    }
  else
    {
        echo 
'Goodbye world!';
    }


HTML:
HTML Code:
<html>
<body>
	<div id="wrapper">
    	<div id="branding">
        	<a href="#">SITENAME</a>
        </div>
        
        <div id="menu">
        	<a href="#">SITENAME</a> | <a href="#">SITENAME</a> | <a href="#">SITENAME</a>
        </div>
	</div>
</body>
</html>

CSS:
Code:
#content {
    background: #000000; color: #FFFFFF;
    width: 800px; height: 500px;
}

      #content a { color: #009900; text-decoration: none; }

            #content a:hover { color: #00CC00; text-decoration: overline; }

      #content p {
           clear: both; float: right;
           width: 150px; height: 250px;
      }

#footer {
    background: #FFFFFF; color: #000000;
    width: 800px; height: 500px;
}
__________________
Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25 - Andrew Rutherford
Send a message via AIM to Randy Send a message via MSN to Randy
Randy is offline  
Reply With Quote
Old 06-14-2009, 09:44 AM   #22 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Quote:
Originally Posted by CoryMathews View Post
@adamdecaf

I do something similar. instead of:

PHP Code:
#content {
    
color#FFFFFF;
}

      
#content a {
           
color#009900;
      
}

            
#content a:hover {
                  
color#00CC00;
            
}

      
#content p {
           
clearleft;
      }

#footer {
    
border1px solid #000000;

I would do

PHP Code:
#content { color:#FFF; }
  #content a { color:#090; }
  #content a:hover { color:#0C0; }
  #content p { clear:left; }
#footer { border:1px solid #000; } 
I always keep the css to 1 line. When you start spacing them out the files get so damn long. We widescreen monitors for a reason. Use them. Also if you put the attributes in alpha order its even easier to find them. (ie border, color, float, width..)

Same thing when I am programming I would do it in the format of

PHP Code:
class blah 
{
  function 
hello
  
{
    if( 
== ) { 
      echo 
"Question"
      for(
010x++) {
        
x++;
        print 
x;
      }
    } 
  }

You sound really arrogant
So just a question on your "1-line-css-rules": What would you do if you have a really big CSS rule? Still on 1 line? Widescreen does have its limits, and IMO it's easier to read if it's spaced out - even if it makes the document longer.
__________________
Tanax is offline  
Reply With Quote
Old 06-14-2009, 10:03 AM   #23 (permalink)
The Addict
 
CoryMathews's Avatar
 
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
CoryMathews is on a distinguished road
Default

@Tanax

If I came off arrogant it was not intended. But honestly not many of my css rules run more then a single line. If they do I have one hell of an instance on my case. Odds are I'm doing something wrong or I have the wrong approach. A bit of looking over can generally remove most all of my word wrap.
CoryMathews is offline  
Reply With Quote
Old 06-14-2009, 03:24 PM   #24 (permalink)
The Addict
 
adamdecaf's Avatar
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Quote:
Originally Posted by CoryMathews View Post
@Tanax

If I came off arrogant it was not intended. But honestly not many of my css rules run more then a single line. If they do I have one hell of an instance on my case. Odds are I'm doing something wrong or I have the wrong approach. A bit of looking over can generally remove most all of my word wrap.
Also your style of HTML will alter how much CSS is needed. If you like to place every block of content in its own (div/p/span) you can space out CSS rules more, while using less (div/p/span)'s will expand each rule.
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 06-15-2009, 08:33 AM   #25 (permalink)
The Contributor
 
Izym's Avatar
 
Join Date: Sep 2007
Posts: 32
Thanks: 0
Izym is on a distinguished road
Default

PHP Code:
$camelCase 1337;

if(
$a == 1)
    echo 
"this is an one line if.";

if(
$a == 2)
{
    echo 
"this is a ";
    echo 
"multiple line if.";
}

function 
camelCase($param)
{
    echo 
"lower camel case for functions, upper for class names.";

And always (real) tabs, 2 or 4 spaces long.
Izym is offline  
Reply With Quote
Reply



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

Advanced Search
Display Modes

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing Clean Code Village Idiot Tips & Tricks 9 05-17-2012 10:51 AM
Tips to Improve Your Coding and Projects Village Idiot Tips & Tricks 42 01-22-2011 09:57 AM
Game: Let's Develop Something Crazy! Wildhoney The Lounge 25 05-23-2009 09:18 PM
Locations based on ZIP code... allworknoplay Absolute Beginners 20 05-13-2009 03:55 PM
Snipply.com - Code snippet website codyodell Show Off 27 04-13-2008 02:09 PM


All times are GMT. The time now is 03:27 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design