Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-10-2007, 06:51 AM   #1
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Some CSS "must knows" from me, and please share yours

More and more people are learning CSS to not just affect the look, but the over all design of their sites.... and not just designers, but people making up their own pages with an average to lower knowledge of design.

For those people, here are some HUGE fundamentals that I have learned that make getting that layout right, much easier.


1. DOCTYPE - cross browser compatibility.
The hardest thing in the world is getting something to look the same in IE, Firefox, Safari and Opera. And there's a reason for that, they all were created unequally. However, there is a way to tell them to try their best to do things the same... and that's the DOCTYPE.

Now, the BEST thing you can do, is learn the subtle differences inherent in XHTML, which includes putting /> as a closer to tags. These things are annoying to learn but once you do, you'll get pages looking just how you want. To make your page an XHTML document, you use this at the very top:

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en' id='yoursitename'>

Notice the word "strict" in there. That is what tells all the browsers that this page MUST use the standards set out by W3C... or at least, to the best of it's ability.

Now, XHTML is a tad annoying in it's differences. So if you don't want to learn those differences as well as CSS all in one shot, then you can simply force your HTML4 to be "strict" as well.
To make your page an HTML4 strict document, you use this at the very top:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>

And that's it... your browsers, no matter what make or model, will try their very best to make sure that 0px really means 0px.

If you use a WYSIWYG editor, pay attention to this because chances are it filled in this line for you and used "loose" settings, rather than strict.
If the line is not used at all, the browser will assume "loose" and try to use it's own best judgment rather than standards.


2. float: left and float:right

For those of you who are actually using divs to position things on a page, float is your best friend. If you want div2 to be to the right of div1, you set div2 to "float:right;". Easy right?

Well, what happens a lot of the times is that yes, div2 will be to the right. But it'll be right justified way over on the right side of the screen.

What went wrong?

Well, it's floating right of div1, but of the entire page as well. The solution to this is to float div1 left. This puts it left justified as it would have been anyway while left alone.... and then float div2 left as well.

This means div1 = left.... div2 = left. That will infact still put them beside each other and in order... but keep them left justified.

You can do this over and over again with however many divs.


3. float:right puts something underneath still

What happens a lot of the times is that someone makes a main div with width 750px. It fits on most resolutions.

Then a left column will be div1 = 250px; and then make div2 float right and width 500px;. The problem? div2 will still be under div1.

The cause for this is that divs have padding and margins by default, and borders even add pixels if you have them on. So if you add padding, margins and borders... 250 + 500 will actually become much more than 750 in the end. This means that div1 and div2 won't fit... and so it wraps down div2 much like a word processor wraps text.

The solution is to manage that padding, margin and border and make sure you keep very close count on just how many pixels are being used for each div. This means counting the LEFT and RIGHT side of the div.


3. clear: both;

So you have some divs floating left and right... but the next div you make, even though it doesn't have a float set... still shows up to the right of the last div! How come???

It's because it's still listening to the CSS of the previous div.

It's for this reason that "clear:both;" was created, but not everyone knows about it.

clear:both is actually just the fast way of saying clear: left AND clear: right... so you could use them individually if you only have one set in the divs above it.

If you have div1 float left, and div2 float left... and want div3 to be neatly underneath, then you'll need a dummy div... like this.

<div1 style='float: left;'> text </div>
<div2 style='float: left;'> text </div>
<div style='clear:both;'></div>
<div3>Text goes underneath here</div>






Most people who know CSS well will say "well, duh" to this stuff. But for people who are just learning to move divs around and use them instead of tables to make layouts.... these things will save you many many headaches down the road.

I hope it helps... and I hope others share their discoveries that have made CSS much easier.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:02 AM   #2
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
CSS rules......yet still way to less people seem to be using it
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:19 AM   #3
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by ServerGenius View Post
CSS rules......yet still way to less people seem to be using it
Well, CSS has been around for a very long time and only now are designers really starting to use it to it's real potential.

It can be intimidating, especially since some problems are difficult to find solutions too.

This is why I created this thread.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:27 AM   #4
cool1
sex is good
 
Join Date: Sep 2001
Location: Carman, MB Canada
Posts: 24,939
trying to learn it all now
it reminds of the first days of learning html
lots of stuff to learn, and long hours doin it.
__________________
cool1 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:32 AM   #5
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by cool1 View Post
trying to learn it all now
it reminds of the first days of learning html
lots of stuff to learn, and long hours doin it.
Yup, it's one of those things that you'll never stop learning better ways to do simple things on your pages. Even after years, you'll do something different one day and go "wow, that's way better than the way I was doing it before!"

CSS, as little vocab or syntax as there is to learn, has millions of different combinations to put together, which makes learning last a long time.

And it's worth it.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:37 AM   #6
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,248
their is a bug with ie and relative
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:44 AM   #7
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
Quote:
Originally Posted by Fris View Post
their is a bug with ie and relative
IE has a another definition of pixel size
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:53 AM   #8
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Fris View Post
their is a bug with ie and relative
IE has a lot of bugs, and using the "strict" DOCTYPE will not be a guarantee of anything... there will still be some things that IE simply will refuse to do according to standards. That's M$ for you.

But at least it's a start.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 07:58 AM   #9
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,248
ya and i noticed yesterday when specifying a height in a table example <table width="468" height="60">

it doesnt like that according to w3 it wants it height="style: height 60"
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 08:00 AM   #10
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Another tip that took me a while to figure out.....

4. Centering a div that has absolute positioning

If you've ever set something to absolute, then tried to put margin: auto on it... you'll be thinking "why does it work in one browser, but not the other one if doctype is set to strict?"

There is a trick to this that will work in all browsers...

First you take the width of the div. In my example, we'll go with 500px;

So we have
#div {
width: 500px;
}

Now we need it to be in the middle... so we apply a "left: 50%;"

#div {
width: 500px;
left: 50%;
}

That puts the left edge of the div in the middle. Which is close, but not right because the center of the div should be in the center of the page.
To solve this, we margin it back by half. Half of 500px is 250px;

#div {
width: 500px;
left: 50%;
margin: 0px 0px 0px -250px;
}

And presto, your absolute positioned div is now dead center in the page.

It's also right at the top edge. Centering it vertically is a whole other beast and will require some javascript, especially if you scroll. And this is a CSS thread, not a javascript thread. Sorry, but it is possible.... keep working and you'll get it.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 08:03 AM   #11
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Fris View Post
ya and i noticed yesterday when specifying a height in a table example <table width="468" height="60">

it doesnt like that according to w3 it wants it height="style: height 60"
Yeah, height= is technically not an attribute in html by most browsers.
Browsers insist that height be set via CSS if at all ( style='height: 60px;' )

If you try to validate your page using W3C's validaters, you'll actually find that a lot of HTML is "deprecated" now, in favor of CSS.

Height never was something common, but in the not too distance future, HTML tags themselves such as <center> and <b> and so on will be unacceptable in good web design.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 08:31 AM   #12
Goodings Media
Confirmed User
 
Goodings Media's Avatar
 
Join Date: Apr 2007
Location: UK
Posts: 1,987
just a headsup.

Theres ways to get around having to use a 'dummy' div with a "clear:both". Having your divs fit snugly into containers means you wont need to, only in a few cases (usually for footers and when you cba to play around)

just as ".clear { clear:both } " with make a pretty big gap too, so will look a little weird.

Good idea to do this thread Shame GFY doesnt have post editing, or you could just keep expanding on the initial post like you would on any other 'tutorial' style forum
__________________
ICQ: 446-568-913 Email: liam||goodingsmedia.com msn: [email protected]
Goodings Media is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 08:37 AM   #13
Goodings Media
Confirmed User
 
Goodings Media's Avatar
 
Join Date: Apr 2007
Location: UK
Posts: 1,987
^^^ sorry for the engrish, noticed too late to edit
__________________
ICQ: 446-568-913 Email: liam||goodingsmedia.com msn: [email protected]
Goodings Media is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 08:55 AM   #14
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Goodings Media View Post
just a headsup.

Theres ways to get around having to use a 'dummy' div with a "clear:both". Having your divs fit snugly into containers means you wont need to, only in a few cases (usually for footers and when you cba to play around)

just as ".clear { clear:both } " with make a pretty big gap too, so will look a little weird.

Good idea to do this thread Shame GFY doesnt have post editing, or you could just keep expanding on the initial post like you would on any other 'tutorial' style forum
It's very true... fitting things in snuggly is the best route to go. Then the next div will simply wrap below. But this can lead to things being off centered or just not quite where you want them sometimes. It's a matter of trial and error... use what serves best at the time.

And yes, it would have been nice to keep adding more and more to post #1. Oh well
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:02 AM   #15
Elli
Reach for those stars!
 
Industry Role:
Join Date: Apr 2003
Location: Vancouver, BC
Posts: 17,991
Bookmarked!
Elli is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:04 AM   #16
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
One of the best advantages to CSS is to programmers.

5. CSS for programmers

CSS makes a slick looking web page, but more importantly, it will greatly simplify your PHP/other code.

Imagine if you will, a gallery that has 15 thumbs in it. You can have your code create a row <tr> and then so many <td>s and then another <tr> at $rowcount=5; and then another <tr>.... and so on. And figure out when to do your ifs and elses.... it's a pain to do something simple.

Now imagine that in CSS, you created a div that's 700px width. So far so good.

Now you can have each thumb set up like this:
<a href='fullsize1.jpg'><img src='thumb1.jpg' class='thumb'></a>
<a href='fullsize2.jpg'><img src='thumb2.jpg' class='thumb'></a>
<a href='fullsize3.jpg'><img src='thumb3.jpg' class='thumb'></a>
...
...
so on.

And CSS the thumbs to float: left;
.thumb {
float: left;
}

Now the thumbs will go next to each other side by side, and wrap on their own down a row once there is not enough room. So you can change the size of your containing div to 500px if you want, and the thumbs will just know what to do on their own!! They'll wrap at a different thumb!

Want to space the thumbs? padding: 5px.
.thumb {
float: left;
padding: 5px;
}

Simple right? Now apply this to your code. Instead of doing the math to figure out when <tr>s start and end.... we just have a simple loop that does all of the images in a stardard output. The CSS does the rest.

This applies to many things, including menu options, lists... what have you.

Your PHP will be simplified once you don't have to figure out where in the code to put counters to track when to enter an HTML element.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:07 AM   #17
gimo33
Confirmed User
 
gimo33's Avatar
 
Join Date: Mar 2006
Posts: 5,599
nice thread.... bookmarked..
__________________
Galleries that sells www.highendcreatives.com Avail of the $10 per gallery, promo!! Highend Designs at Low Price. Contact us now!
gimo33 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:08 AM   #18
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
Quote:
Originally Posted by StuartD View Post
One of the best advantages to CSS is to programmers.

5. CSS for programmers

CSS makes a slick looking web page, but more importantly, it will greatly simplify your PHP/other code.

Imagine if you will, a gallery that has 15 thumbs in it. You can have your code create a row <tr> and then so many <td>s and then another <tr> at $rowcount=5; and then another <tr>.... and so on. And figure out when to do your ifs and elses.... it's a pain to do something simple.

Now imagine that in CSS, you created a div that's 700px width. So far so good.

Now you can have each thumb set up like this:
<a href='fullsize1.jpg'><img src='thumb1.jpg' class='thumb'></a>
<a href='fullsize2.jpg'><img src='thumb2.jpg' class='thumb'></a>
<a href='fullsize3.jpg'><img src='thumb3.jpg' class='thumb'></a>
...
...
so on.

And CSS the thumbs to float: left;
.thumb {
float: left;
}

Now the thumbs will go next to each other side by side, and wrap on their own down a row once there is not enough room. So you can change the size of your containing div to 500px if you want, and the thumbs will just know what to do on their own!! They'll wrap at a different thumb!

Want to space the thumbs? padding: 5px.
.thumb {
float: left;
padding: 5px;
}

Simple right? Now apply this to your code. Instead of doing the math to figure out when <tr>s start and end.... we just have a simple loop that does all of the images in a stardard output. The CSS does the rest.

This applies to many things, including menu options, lists... what have you.

Your PHP will be simplified once you don't have to figure out where in the code to put counters to track when to enter an HTML element.
same strategy works to define colors, fonts, backgrounds/colors, table styles
form styles....that way you can keep all html basic and do all the styling with
seperate css.files which you include in the head part of the html
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:14 AM   #19
lucas131
¯\_(ツ)_/¯
 
Industry Role:
Join Date: Aug 2004
Posts: 11,475
I still hate tableless designing :X
lucas131 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:16 AM   #20
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
Quote:
Originally Posted by lucas131 View Post
I still hate tableless designing :X
you'd still use tables but without table properties like width, height, color,
align or anything else, instead you use CSS to define all those so you could
use the same html for multiple pages that look different but just changing
the stylesheet. Very handy for galleries, templates
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:19 AM   #21
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by lucas131 View Post
I still hate tableless designing :X
It doesn't have to be so bad. When done right, you can convert ANY tabled design into a CSS/div design and have 0 differences in appearance...

but the same can't be said for vice versa.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:43 AM   #22
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
In response to the UL/LI concern here:
http://www.gofuckyourself.com/showthread.php?t=750133

6. Lists are not the same in IE/Firefox

* For this post, I'm using "UL" but this works the exact same for "OL" lists as well.

Lists are handled differently across multiple browsers even when you use the strict DOCTYPE. Why? I don't know. But IE tends to think it knows best about indenting and will try to do so no matter what.

The way around this is to force your list and your listed items to nothing... and then work from there.
For Example:

ul {
list-style: none;
margin: 0px;
padding: 0px;
}

li {
margin: 0px;
padding: 0px;
}

This will make everything line up along the left hand side, no indents, no spacing.... no bullet points. Nothing. And it will do it in every browser.

Now, there's no limit to where you can go from here. You can push things apart vertically, indent things... what ever you want. And your pixels will count the same in IE and in Firefox from here on out.

But my suggestion is this... if you want the list as a whole moved, use the margin in the ul style. Otherwise, don't touch.

You can handle most eveything you'll need to with the li styles. This will save you a lot of headaches later as you try to position things around your list.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:48 AM   #23
Azlord
Confirmed User
 
Azlord's Avatar
 
Industry Role:
Join Date: Dec 2003
Location: City... City of Satan
Posts: 2,651
Good thread. Bump
Azlord is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 09:50 AM   #24
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
I wasn't going to bother with this, because it's fairly basic and this thread is more for "problems that people get stuck on".... but after mentioning the list styles, this should be covered.

7. margin/padding: top right bottom left

99% of the time, you'll see something like this:
#div {
padding: 5px;
}


What this does is adds 5 pixels of padding on top, right, bottom and left of the div. All around it!!

This is usually good enough, but not always. Sometimes we just want to put some padding to the left of it, to keep it from bumping into something else.

To do this, we have to specify what we want for each of the sides. And doing things in order is very important.
#div {
padding: 0px 0px 0px 5px;
}

This will put 0 pixels of padding on the top, the right and the bottom but it will put 5 pixels of padding on the left.

It's VERY IMPORTANT to keep it in that order... because the browser will, even if you don't.


So, going back to point 6 in this thread, if you want to indent your li elements inwards a few pixels, you would add this:
li {
margin: 0px 0px 0px 3px;
padding: 0px;
}

This will bump in each li element by 3 pixels. If they're too close vertically, you can add some underneath too.
li {
margin: 0px 0px 3px 3px;
padding: 0px;
}

It's pretty easy, but it's important to remember the order around the element.
Top, Right, Bottom, Left.
Keep that in mind and you can move things, or pad them, anywhere you want.

Last edited by Ice; 07-10-2007 at 09:58 AM..
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 10:53 AM   #25
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
No one else have anything to add?
Any questions?
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 11:20 AM   #26
BitAudioVideo
Confirmed User
 
Join Date: Jul 2005
Location: USA, Georgia
Posts: 1,246
Quote:
Originally Posted by lucas131 View Post
I still hate tableless designing :X
tables are for spreadsheets!

css is simple, i pay a guy that knows how to do it =]
__________________
Hi-Quality Encoding - Bulk Orders - On Time!
http://bitaudiovideo.com
icq 50476697 - aim n3r0xXx
BitAudioVideo is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 11:30 AM   #27
Horny Dude
Earn enough to buy coffee
 
Horny Dude's Avatar
 
Industry Role:
Join Date: May 2002
Location: San Diego, Ca.
Posts: 4,912
I'm big on tables but have been messing with CSS layouts more and more. They just seem cleaner. Great thread StuartD!
__________________
Horny Dude is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 11:46 AM   #28
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Horny Dude View Post
I'm big on tables but have been messing with CSS layouts more and more. They just seem cleaner. Great thread StuartD!
Thank you. I decided to put together a couple of examples just to demonstrate... maybe not the best (they're done fast) but they should give you the right idea.

1. This is the thumbs idea from #5. You can resize the browser as wide or as narrow as you like and see how the thumbs will just fit.
I challenge you to try it with a table layout.
http://www.9xs.net/thumbs.html



2. This one is a basic layout with a header, left and right column and a footer (copyright).
Look at the source code to see the actual html (everything after the <body>).
There's almost nothing to it at all. Take out the CSS at the top of the page and you'll have a very basic page.
http://www.9xs.net/layout.html



Hopefully these help to illustrate some of my points.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 12:07 PM   #29
Art Del Gado
Confirmed User
 
Art Del Gado's Avatar
 
Join Date: Nov 2003
Location: Los Angeles, CA
Posts: 960
thanks for the info stuart, you truly know what your talking about
__________________
Art Del Gado
ICQ: 616143
Art Del Gado is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 12:15 PM   #30
Verbal
Confirmed User
 
Join Date: Dec 2001
Location: Tampa, FL
Posts: 3,420
Very cool - thanks for taking the time
Verbal is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 12:33 PM   #31
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by pornopete View Post
The flaw with CSS is it's based on a programming concept, not a design concept. Designers aren't programmers.
As opposed to HTML that uses rows and columns?
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 12:56 PM   #32
wild_s
Registered User
 
Join Date: Sep 2006
Posts: 36
Yes, thanks for the great info! I've been a table jockey for far too long. The hardest thing about training is finding the time, these quick tutorials are great!
wild_s is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 01:03 PM   #33
yahoo-xxx-girls.com
Confirmed User
 
yahoo-xxx-girls.com's Avatar
 
Join Date: Jul 2006
Location: Canada
Posts: 3,143
CSS is great !

Hi StuartD,

My site uses XML/XSLT & CSS.

In the start I did not like CSS because I did not understand it, however after using it I find it is great...

To visit my site click here.
yahoo-xxx-girls.com is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 03:17 PM   #34
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
keep posting questions or CSS tips, this is a great thread and even for the
ones that are familiar with CSS you can learn new tricks or tips posted by
others.....especially since with CSS there's many different ways to accomplish
the same result.
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 05:11 PM   #35
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by ServerGenius View Post
keep posting questions or CSS tips, this is a great thread and even for the
ones that are familiar with CSS you can learn new tricks or tips posted by
others.....especially since with CSS there's many different ways to accomplish
the same result.
This thread isn't entertaining enough for people to care about.

But it's ok, if it helped even one person, that's good enough for me.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-10-2007, 06:00 PM   #36
ServerGenius
Confirmed User
 
Join Date: Feb 2002
Location: Amsterdam
Posts: 9,377
Quote:
Originally Posted by StuartD View Post
This thread isn't entertaining enough for people to care about.

But it's ok, if it helped even one person, that's good enough for me.
mission accomplished then
__________________
| http://www.sinnerscash.com/ | ICQ: 370820 | Skype: SinnersCash | AdultWhosWho |
ServerGenius is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-01-2007, 02:31 PM   #37
mrthumbs
salad tossing sig guy
 
mrthumbs's Avatar
 
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
we need more threads like this!
mrthumbs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-01-2007, 03:20 PM   #38
porntertainment
Confirmed User
 
Join Date: Dec 2006
Location: The Internet
Posts: 151
I only started using CSS in the past six months or so. I'm not much a code junky and for the most part I'm just using it to tweak blogs or make simple galleries, but let me tell you it's fucking amazing how even simple things like float:left and float:right make life so much easier for me.

Before CSS, I was using tables in gallery design.

My galleries look much nicer, much cleaner, and actually convert a little better with the same sponsors (although their real test is coming in the next few days when my new Hun galleries start getting listed).
porntertainment is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-01-2007, 03:30 PM   #39
Young
Bland for life
 
Industry Role:
Join Date: Nov 2004
Posts: 10,468
wouldn't

margin: 0px auto;

accomplish auto centering?

EDIT: Forget it...I noticed you said absolute.
__________________
★★★
Young is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-01-2007, 04:58 PM   #40
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by mrthumbs View Post
we need more threads like this!
Thank you kindly.
I have some more tricks that I can demonstrate, if anyone would like for me to share.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-01-2007, 05:30 PM   #41
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Why use XHTML strict?? I was going to try and do that but found it too limiting for me and so I've been using XHTML Transitional and am VERY happy with the results I'm getting. I've been validating all my pages as I do them until I'm very proficient at it.. (pretty much there now but it still helps as it catches errors).

The one thing I don't understand with CSS is the difference between using "#" or ".". My understanding is that # is used only for items that will be used once on the page and you set the id= parameter.. the other is for a "class" which can be used multiple times... So why not just make everything a class and then you don't have to worry about it? I've noticed some sites get it wrong where they define something using # and then use it in multiple locations.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-01-2007, 05:40 PM   #42
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Tempest View Post
Why use XHTML strict?? I was going to try and do that but found it too limiting for me and so I've been using XHTML Transitional and am VERY happy with the results I'm getting. I've been validating all my pages as I do them until I'm very proficient at it.. (pretty much there now but it still helps as it catches errors).

The one thing I don't understand with CSS is the difference between using "#" or ".". My understanding is that # is used only for items that will be used once on the page and you set the id= parameter.. the other is for a "class" which can be used multiple times... So why not just make everything a class and then you don't have to worry about it? I've noticed some sites get it wrong where they define something using # and then use it in multiple locations.
Firstly.... strict is what i recomment for xhtml and for html as it is the closest to "standards compliant" that it will get. It means that even IE (yes, the devil browser) will try it's damnedest to be compliant and display your CSS the way that it's meant to be displayed.
If you don't do a ton of less compatible stuff, then transitional would be quite fine as it sort of interprets things as best it can without being... well, strict.

Secondly, ID's and classes are meant to be used as if it were chapters and volumes in a novel. An ID for an area, such as "rightcolumn" that would only ever be set once, and then classes within it that might be used over and over within that "volume".

But yes, I agree... it really would make sense to just use classes all the time really. It would work just as well.
Someone somewhere along the way decided on "structure" and chose ID's and classes.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 12:22 PM   #43
Deej
I make pixels work
 
Deej's Avatar
 
Industry Role:
Join Date: Jun 2005
Location: I live here...
Posts: 24,386
couple tidbits I didnt know.

THanks Stu
__________________

Deej's Designs n' What Not
Hit me up for Design, CSS & Photo Retouching


Icq#30096880
Deej is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 12:43 PM   #44
JamesK2
Confirmed User
 
Join Date: Aug 2004
Location: The Netherlands
Posts: 6,589
thanks for the info I'm learning CSS atm and this thread is very useful
__________________
JamesK2 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 01:03 PM   #45
testpie
Mostly retired
 
testpie's Avatar
 
Industry Role:
Join Date: Apr 2006
Location: UK
Posts: 3,231
Here's a quick tip:

Instead of wrangling with every element and having to put margin:0;padding:0; use this at the top of your CSS:
Code:
* {
 margin:0;
 padding:0;
}
This works by using the wildcard match to make every element on the page have no padding and no margin without having to constantly redefine these.

Enjoy.
__________________

Affiliates: DogFart ~ Domain parking: NameDrive ~ Traffic broker: Traffic Holder
testpie is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 01:30 PM   #46
Lycanthrope
Confirmed User
 
Lycanthrope's Avatar
 
Industry Role:
Join Date: Jan 2004
Location: Wisconsin
Posts: 4,517
Quote:
Originally Posted by testpie View Post
Here's a quick tip:

Instead of wrangling with every element and having to put margin:0;padding:0; use this at the top of your CSS:
Code:
* {
 margin:0;
 padding:0;
}
This works by using the wildcard match to make every element on the page have no padding and no margin without having to constantly redefine these.

Enjoy.
The single best thing you can do to "zero out" every browser across the board
__________________
Lycanthrope is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 01:51 PM   #47
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
Great thread and great idea!

But, there's a lot I don't understand with CSS, and Stuart's example below shows my ignorance. Take the Acid 2 Test and see if your browser is compliant...

Safari 3 passes the test, Opera 9 neerly passes (nose colour wrong), and besides some very minor other browsers that's it.

The reason I bring this up is that Safari 3, 100% compliant, renders the below wrong. There is no header - the images start and the text wraps around.

CSS is great, and these kinda rules are essential, but it goes much deeper than simple rules - the only rule is to test in as many browsers as possible.

Quote:
Originally Posted by StuartD View Post
Thank you. I decided to put together a couple of examples just to demonstrate... maybe not the best (they're done fast) but they should give you the right idea.

1. This is the thumbs idea from #5. You can resize the browser as wide or as narrow as you like and see how the thumbs will just fit.
I challenge you to try it with a table layout.
http://www.9xs.net/thumbs.html



2. This one is a basic layout with a header, left and right column and a footer (copyright).
Look at the source code to see the actual html (everything after the <body>).
There's almost nothing to it at all. Take out the CSS at the top of the page and you'll have a very basic page.
http://www.9xs.net/layout.html



Hopefully these help to illustrate some of my points.
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 03:17 PM   #48
Twisted Dave
Confirmed User
 
Twisted Dave's Avatar
 
Join Date: Mar 2006
Posts: 3,635
Excellent thread! BUMP!
__________________


Custom Cartoon Mascots - ICQ: 243355699, Email: [email protected] or Click Sig - 15% referrals. Send me clients, make money!
Twisted Dave is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 03:20 PM   #49
Tempest
Too lazy to set a custom title
 
Industry Role:
Join Date: May 2004
Location: West Coast, Canada.
Posts: 10,217
Quote:
Originally Posted by testpie View Post
Here's a quick tip:

Instead of wrangling with every element and having to put margin:0;padding:0; use this at the top of your CSS:
Code:
* {
 margin:0;
 padding:0;
}
This works by using the wildcard match to make every element on the page have no padding and no margin without having to constantly redefine these.

Enjoy.
Nice one.. didn't know about *.. there's some special things like that that I'm not aware of.
Tempest is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-02-2007, 03:31 PM   #50
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
50 CSS tips and tricks....

Let's keep sharing!
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.