GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Some CSS "must knows" from me, and please share yours (https://gfy.com/showthread.php?t=750159)

Tempest 09-01-2007 05:30 PM

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.

StuartD 09-01-2007 05:40 PM

Quote:

Originally Posted by Tempest (Post 13021004)
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.

Deej 09-02-2007 12:22 PM

couple tidbits I didnt know.

THanks Stu

JamesK2 09-02-2007 12:43 PM

thanks for the info I'm learning CSS atm and this thread is very useful :)

testpie 09-02-2007 01:03 PM

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. :thumbsup

Lycanthrope 09-02-2007 01:30 PM

Quote:

Originally Posted by testpie (Post 13023436)
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. :thumbsup

The single best thing you can do to "zero out" every browser across the board :thumbsup

borked 09-02-2007 01:51 PM

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 (Post 12734136)
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.


Twisted Dave 09-02-2007 03:17 PM

Excellent thread! BUMP!

Tempest 09-02-2007 03:20 PM

Quote:

Originally Posted by testpie (Post 13023436)
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. :thumbsup

Nice one.. didn't know about *.. there's some special things like that that I'm not aware of.

StuartD 09-02-2007 03:31 PM

50 CSS tips and tricks....

Let's keep sharing!

LadyMischief 09-02-2007 05:01 PM

Awesome thread, Stu, bookmarked! You know how much I LOOOOVE Css... grrr

MicDoohan 09-03-2007 01:56 AM

one problem i have with my 3 column wordpress css layouts is how to make the 2 colored sidebar columns go all the way to the bottom - as it stands they only go down as far as there is content in them.

any tips css gurus ?

AlienQ - BANNED FOR LIFE 09-03-2007 01:58 AM

CSS is the suck and not necessary.

mrthumbs 09-03-2007 03:02 AM

Quote:

Originally Posted by AlienQ (Post 13025254)
CSS is the suck and not necessary.

Start using it and maybe one day your designs will advance the mid 90's

quantum-x 09-03-2007 03:10 AM

I must say, to me 'pure css' designs, still seem in the realm of 'hacky' at best, but I love making hybrids : let tables make the main structure, throw in divs and css for the rest, match made in heaven.

Twisted Dave 09-03-2007 03:50 AM

Quote:

Originally Posted by quantum-x (Post 13025364)
I must say, to me 'pure css' designs, still seem in the realm of 'hacky' at best, but I love making hybrids : let tables make the main structure, throw in divs and css for the rest, match made in heaven.

What are you talking about? CSS is useable without being hacky in the slightest.

cykoe6 09-03-2007 03:55 AM

Ths is a really great thread. I hate CSS with a passion but as a full time blogger I am always dealing with it in my WP themes. I find that even the simplest adjustment takes forever to figure out in CSS.... but maybe this thread will help me.

Grisey 09-03-2007 03:56 AM

Not mine but an old bookmark

http://www.smashingmagazine.com/2007...-live-without/

testpie 09-03-2007 04:09 AM

Quote:

Originally Posted by MicDoohan (Post 13025251)
one problem i have with my 3 column wordpress css layouts is how to make the 2 colored sidebar columns go all the way to the bottom - as it stands they only go down as far as there is content in them.

any tips css gurus ?

Just adapt the code from this site: http://www.tanfa.co.uk/css/layouts/c...-layout-v1.asp and remove the footer if you don't want it.

testpie 09-03-2007 04:10 AM

Quote:

Originally Posted by Lycanthrope (Post 13023509)
The single best thing you can do to "zero out" every browser across the board :thumbsup

What do you mean?

Sorry for the double post.

potter 09-03-2007 04:47 AM

I'm sorry, but your number one tip??? What does css designing have to do with doctype? If you design a website, in tables or css the doctype has nothing to do with how it's displayed in a browser. I've been doing pure css design for a long time now, and can write my code in either doctype properly with no errors or warnings off hand. However, even if you say wrote xhtml strict code, with a html 4.0 doctype. It would still end up rendering the same in a browser.

StuartD 09-03-2007 05:17 AM

Quote:

Originally Posted by potter (Post 13025524)
I'm sorry, but your number one tip??? What does css designing have to do with doctype? If you design a website, in tables or css the doctype has nothing to do with how it's displayed in a browser. I've been doing pure css design for a long time now, and can write my code in either doctype properly with no errors or warnings off hand. However, even if you say wrote xhtml strict code, with a html 4.0 doctype. It would still end up rendering the same in a browser.

CSS designing has everything to do with DOCTYPE.

The official differences are found here: http://www.w3schools.com/tags/tag_doctype.asp

You can read more about how they function differently here:
http://www.oreillynet.com/pub/a/java...8/doctype.html

Personally, I have found that I can really struggle getting my CSS layouts to look exactly the same in all browsers until I make the doctype strict.

Certain things like top 0 and left 0 can be very different in FF and in IE... until you set things to strict.

Fletch XXX 09-03-2007 05:30 AM

K.I.S.S. is my only rule.

StuartD 09-03-2007 05:57 AM

Quote:

Originally Posted by Grisey (Post 13025454)

That's quite the awesome link, some very good stuff in there. I don't like that most of it uses javascript in some way, it isn't pure CSS tricks.
But then, CSS isn't meant to be used entirely by itself. It's meant to be used in conjunction with javascript, so it's not all bad :)

quantum-x 09-03-2007 07:01 AM

Quote:

Originally Posted by twisted Illustration (Post 13025447)
What are you talking about? CSS is useable without being hacky in the slightest.

I don't believe you :P

Matt 26z 09-03-2007 09:19 AM

Quote:

Originally Posted by StuartD (Post 12732686)
there will still be some things that IE simply will refuse to do according to standards. That's M$ for you.

You know what's funny though, is that MS went against the standards and supported CSS many years before W3C recommended it. It didn't even work in Netscape at all when MS introduced support for it. So one could say that it was MS's rogue behavior that got the ball rolling.

Now we've got W3C (whom MS has never been on great terms with) and Firefox demanding things be done a certain way. Fact is, they have no room to talk. As long as MS controls 90-95% of the market, they don't need to listen to the little guys creating their "official" standards. In reality, whatever MS does is THE standard that designers will live by.

Yeah, it really sucks that MSIE and Firefox don't work exactly the same. But my point is, MS needs to have most of the influence at W3C given their market position.

BOSS1 09-03-2007 09:26 AM

bookmarking

Matt 26z 09-03-2007 09:30 AM

Quote:

Originally Posted by mrthumbs (Post 13025360)
Start using it and maybe one day your designs will advance the mid 90's

Actually, CSS has nothing to do with the end design. If you put an all HTML design next to the CSS version of the same design, you shouldn't be able to spot any differences.

The original CSS construction is more time consuming than an HTML design. So if we are talking about one off "build it and forget it" pages then I stick with HTML. But if this is for a major site that may require a little tweak that is on every page, then CSS is the way to go.

martinsc 09-03-2007 09:48 AM

awesome thread :thumbsup
great tips, StuartD :thumbsup
bookmarked

StuartD 09-03-2007 09:49 AM

Quote:

Originally Posted by Matt 26z (Post 13026563)
Actually, CSS has nothing to do with the end design. If you put an all HTML design next to the CSS version of the same design, you shouldn't be able to spot any differences.

The original CSS construction is more time consuming than an HTML design. So if we are talking about one off "build it and forget it" pages then I stick with HTML. But if this is for a major site that may require a little tweak that is on every page, then CSS is the way to go.

100&#37; entirely false.... sorry to say.

An all HTML design is actually quite not possible, especially in today's world of tours and layouts.
I say that because tables were never meant for designs, they were meant for data organization... such as spreadsheets.

The only way to do many designs strictly in HTML is to have nested tables and that's very bad form. Especially in IE which requires the entire contents of the table to be downloaded before rendering any single part of it to the screen.

HTML is a markup language which is little more than a way to present information to the browser in lists, forms, tables and so on.

CSS is the styling tool that is used to make that information look good.

And if you begin creating your pages with CSS, it will take WAY less time than to do it strictly with HTML alone.... as you will require 1/3 or less HTML to accomplish your goals.

Tempest 09-03-2007 12:02 PM

Quote:

Originally Posted by MicDoohan (Post 13025251)
one problem i have with my 3 column wordpress css layouts is how to make the 2 colored sidebar columns go all the way to the bottom - as it stands they only go down as far as there is content in them.

any tips css gurus ?

Can't remember what I did now but I think it can't be done the way you'd "think" it could be done... I think I ended up setting the main div (with the height 100%, overflow:hidden as in the thread below) background color to what I wanted to side bars to be and then set the background color of the content (middle column).

Check out what I went thru over here
http://www.gofuckyourself.com/showthread.php?t=756104

Tempest 09-03-2007 12:07 PM

Quote:

Originally Posted by quantum-x (Post 13025364)
I must say, to me 'pure css' designs, still seem in the realm of 'hacky' at best, but I love making hybrids : let tables make the main structure, throw in divs and css for the rest, match made in heaven.

I still use tables for thumb blocks and for things I want the SEs to treat with a lower priority, but over the last month I've spent the time to figure out how to do my main layouts in css... everything I design is done with an eye to SEO and I've found doing it this way works out really well..

potter 09-03-2007 03:55 PM

Quote:

Originally Posted by StuartD (Post 13025584)
CSS designing has everything to do with DOCTYPE.

The official differences are found here: http://www.w3schools.com/tags/tag_doctype.asp

You can read more about how they function differently here:
http://www.oreillynet.com/pub/a/java...8/doctype.html

Personally, I have found that I can really struggle getting my CSS layouts to look exactly the same in all browsers until I make the doctype strict.

Certain things like top 0 and left 0 can be very different in FF and in IE... until you set things to strict.

Go reread those articles yourself. The ONLY differences it mentions is font styling. Like I said, the actual design of a website will not be changed at all even if the doctype is changed.

Seriously, I could go through my portfolio and make a copy of every single design and change the doctype on the copies. They'll all look exactly the same.

Example;
Code:

<table>
 <tr>
  <td>&nbsp;</td>
 </tr>
</table>

&

Code:

<div style="position: relative; top: 0px; left: 0px; height: 100px; width: 100px;"></div>
No matter what doctype is applied to either of those, the end result will look EXACTLY the same. I'm willing to put money on it.

Tempest 09-03-2007 04:07 PM

Quote:

Originally Posted by potter (Post 13027849)
No matter what doctype is applied to either of those, the end result will look EXACTLY the same. I'm willing to put money on it.

You may be right in that example, but I can say for a fact that changing the doc type can make a page that used to look good get all fucked up.

StuartD 09-03-2007 06:10 PM

Quote:

Originally Posted by potter (Post 13027849)
Go reread those articles yourself. The ONLY differences it mentions is font styling. Like I said, the actual design of a website will not be changed at all even if the doctype is changed.

Seriously, I could go through my portfolio and make a copy of every single design and change the doctype on the copies. They'll all look exactly the same.

Example;
Code:

<table>
 <tr>
  <td>&nbsp;</td>
 </tr>
</table>

&

Code:

<div style="position: relative; top: 0px; left: 0px; height: 100px; width: 100px;"></div>
No matter what doctype is applied to either of those, the end result will look EXACTLY the same. I'm willing to put money on it.

That's a very simplistic example... start floating some divs, add margins and padding and lists within them.... and then see if the DOCTYPES make any difference.

potter 09-04-2007 08:17 AM

Let's see either of you make a quick design, copy it, and use a different doctype on each one. I'd love to see what you're talking about.

potter 09-04-2007 08:37 AM

Here's one of my older designs, 100% pure css of course.

http://pulsedesign.biz/printer/css.html 100% pure CSS using xhtml strict code. CSS has positive and relative positions, also has some floats. Should be a more "advanced example" for you.

w3c valid code; http://validator.w3.org/check?uri=ht...r%2 Fcss.html

w3c valid (no warnings) css; http://jigsaw.w3.org/css-validator/v...er/printer.css

Now we'll take the same page, and change nothing but the doc type. Changing it from xhtml 1.0 strict, to html 4.01 strict.
- http://pulsedesign.biz/printer/css-doctype.html
Page is displayed EXACTLY the same. I tested in FF 2.0x and Safari on OSX, and IE 6.0x on Windows XP.

I could pull out hundreds more designs and show you the same thing over and over. Instead, I showed an example on my end. Let's see one on your end.

StuartD 09-04-2007 09:02 AM

Quote:

Originally Posted by potter (Post 13030658)
Here's one of my older designs, 100% pure css of course.

http://pulsedesign.biz/printer/css.html 100% pure CSS using xhtml strict code. CSS has positive and relative positions, also has some floats. Should be a more "advanced example" for you.

w3c valid code; http://validator.w3.org/check?uri=ht...r%2 Fcss.html

w3c valid (no warnings) css; http://jigsaw.w3.org/css-validator/v...er/printer.css

Now we'll take the same page, and change nothing but the doc type. Changing it from xhtml 1.0 strict, to html 4.01 strict.
- http://pulsedesign.biz/printer/css-doctype.html
Page is displayed EXACTLY the same. I tested in FF 2.0x and Safari on OSX, and IE 6.0x on Windows XP.

I could pull out hundreds more designs and show you the same thing over and over. Instead, I showed an example on my end. Let's see one on your end.

Ok, first of all... I was talking about the differences between strict and transitional (and also included is loose) used in doctypes. Not about the differences between xhtml and html 4.

Secondly, your html 4 infact does not validate as you have left in the close tags ( /> ) items from your xhtml document. Those aren't required nor valid in html.

potter 09-04-2007 09:25 AM

Quote:

Originally Posted by StuartD (Post 13030795)
Ok, first of all... I was talking about the differences between strict and transitional (and also included is loose) used in doctypes. Not about the differences between xhtml and html 4.

Ok.
http://pulsedesign.biz/printer/css-transitional.html
&
http://pulsedesign.biz/printer/css-frameset.html
& the original (strict)
http://pulsedesign.biz/printer/css.html

Again, only changing the doctype. This time as per "what you were talking about", keeping it the same xhtml but changing the strict/transitional. Tested in FF 2.0x and Safari on OSX, and IE 6.0x on Windows XP. All still render EXACTLY the same. :thumbsup

Quote:

Originally Posted by StuartD (Post 13030795)
Secondly, your html 4 infact does not validate as you have left in the close tags ( /> ) items from your xhtml document. Those aren't required nor valid in html.

What???? Wow, no kidding? It's written for xhtml 1.0 strict. You did notice only the DOCTYPE was changed right? Because we're talking about changing doctypes, not rewriting an entire page after changing the doctype. Yet even in the example shown, a design written in xhtml strict code, can still have the doctype changed to a totally different type (html 4.01) which completely invalidates the code, and it still renders EXACTLY the same in all browsers.


.........So would you please just post up an example of two designs. Code on both exactly the same, with just the doctype changed. Where the end result is the design being rendered differently?

potter 09-04-2007 09:31 AM

Also, if you're against using xhtml as an example. I'll even do the same with a design coded in html 4.01. 100&#37; css, w3c valid page, w3c valid css (no warnings). I'll keep the code exactly the same but just change the doctypes from html 4.01 strict, to html 4.01 loose - html 4.01 frameset - and even xhtml strict - xhtml frameset - xhtml transitional. Six pages, all the same code, each with different doctypes. All will render the same in all browsers.


All times are GMT -7. The time now is 08:13 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc