Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Talking to Myself in HTML

Author
Message
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 1st Nov 2013 20:38
I have been learning some neat CSS tricks and thought I'd share them with you guys. Download the attached page, or if you prefer, save the text in the code box as an html file.



Formerly OBese87.

Attachments

Login to view attachments
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 1st Nov 2013 21:19
Where is the trick? I can't find any.

The Next
Web Engineer
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: United Kingdom
Posted: 2nd Nov 2013 01:28 Edited at: 2nd Nov 2013 01:29
I assume he is talking about the CSS3 gradients, not many people are familiar with these yet.

They are great little extras... If only the browser support was a bit better.

Windows 7 Pro, Intel i7 3.8 GHz, 16GB DDR3, NVIDIA GTX 780 4GB Superclocked
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Nov 2013 22:11 Edited at: 2nd Nov 2013 22:22
Quote: "I assume he is talking about the CSS3 gradients, not many people are familiar with these yet. They are great little extras... If only the browser support was a bit better."

Yes. Using them to make patterned backgrounds is really clever and fast loading.

Quote: "Where is the trick? I can't find any."

What browser are you using? It will work for Firefox and webkit browsers (eg Chrome), but I haven't added the lines for IE or Opera compatibility.

It should look like this -->


Formerly OBese87.

Attachments

Login to view attachments
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 3rd Nov 2013 02:52
for css3 support in older IE, I highly recommend http://css3pie.com/

mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 3rd Nov 2013 09:56
Quote: "What browser are you using? It will work for Firefox and webkit browsers"

Chrome. I just don't see anything unusual (gradients are always in every learning book for beginners). Also I don't think it is a good idea to write functions to draw backgrounds "on the fly". What if I want circles and flowers? It's way better to draw 5KB png than code it. No speed affecting.

But gradients for buttons is very good, it's better that to draw png's, indeed. But, as I said, it is not a "trick", it is in every learning book. Er-hem, >modern< learning book, of course.

The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 3rd Nov 2013 10:18
Quote: "What if I want circles and flowers? It's way better to draw 5KB png than code it."


That is not really true. Unless you know you want "circles and flowers", sending extra requests and forcing clients to download more images is a bad idea, its much better to let the client generate the graphics localy since that is verry efficient. Also, if you want an interesting background that isnt annoying, you would need an image that is bigger than 5KB...

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 3rd Nov 2013 10:30
Quote: " But, as I said, it is not a "trick", it is in every learning book. Er-hem, >modern< learning book, of course."

I gave you the benefit of the doubt but of course you were just being aloof and facetious as usual.
Linear gradients were not designed to draw solid stripes, getting an effect out of something that it was not designed for is a trick in my book. I'm sorry if I disappointed you and you were expecting a fireworks show and a marching band to appear out of HTML code.


Formerly OBese87.
The Next
Web Engineer
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: United Kingdom
Posted: 3rd Nov 2013 11:47
@Ortu
That is a great site I hadn't found that one yet so thank you it will no doubt come in handy.

@Everyone
The benefits of having the client draw anything via CSS is massive. The biggest one is you have got no extra requests, requests are what really slow down a page (especially if they result in a 404).
You are using no extra bandwidth, it is all contained in a text file (that the client will be downloading anyway). Images take far longer to request, download and interpret than a few lines of code do that are downloaded all in one go in the page head.

There is also no issue with modern browsers not having the power to do this on the fly rendering even smart phones have more than enough processing power to do it.

Windows 7 Pro, Intel i7 3.8 GHz, 16GB DDR3, NVIDIA GTX 780 4GB Superclocked
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 3rd Nov 2013 15:59
I think it looks pretty good. Anything which increases page loading is of great benefit to web developers. Especially developers of pages which generate income, no-one wants to hang around for a page to load in this day and age. Even smartphones are capable of 40Meg downloads, so waiting for a website to load content is a bad thing.

As people demand faster and faster, if a casual page takes longer than a few seconds to load people will not bother to wait for it to load. I know I don't.

mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 3rd Nov 2013 21:36 Edited at: 3rd Nov 2013 21:39
Quote: "I'm sorry if I disappointed you"

Nah.

Quote: "Linear gradients were not designed to draw solid stripes"

There are lots of tricks with gradients in Photoshop

I saved this (random find) background in png: ~30KB


Now how many lines of code do you need to draw this?

Or, if you talking only about simple geometric image elements like boxes, lines, circles, etc. Even in that case I would prefer an image. That's why:
-moz-linear-gradient
-webkit-linear-gradient
-IE support

You may call me a lazy butt, but writing and testing compatibility of such tricks is an overkill for me.

P.S. I think I may agree that this is a trick, as I use gradients in photoshop not as they should be used too

edit: typos

The Zoq2
14
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 3rd Nov 2013 21:51
Having those flowers would require a ton of code and using an image would be a lot better, but for more simple, repeating patterns a code based gradient is a lot better for performance, but it will always come down to what the use is.

Say ONE stupid thing and it ends up as a forum signature forever. - Neuro Fuzzy
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 3rd Nov 2013 21:54
Quote: "but for more simple, repeating patterns"

I am not trying to argue, but IMHO simple patterns would be nicer with antialiasing, i.e. additional aa code required.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Nov 2013 06:51
Quote: " It's way better to draw 5KB png than code it. No speed affecting."


Not necessarily. I worked on a high-traffic site before. Trimming just a few KBs saved several gigs of bandwidth. Also, loading a single CSS file containing css sprites versus several images cuts down on the number of http requests.

mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 4th Nov 2013 22:44
Quote: "containing css sprites"

base64 string?

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 5th Nov 2013 08:10
Background image of this site could be easily generated but no, here it is:


Those tricks are good, but I think I miss the point:
1. This trick supposed to be designer's trick.
2. This trcik appears to be webmaster's trick.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Nov 2013 13:08
Handy: You seem to have the impression that CSS is supposed to be an answer for everything, it's not, it is there to aid designers not replace them.


Formerly OBese87.
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 6th Nov 2013 17:33 Edited at: 6th Nov 2013 17:34
In my opinion, the greatest benefit of CSS gradients is maintenance-related. If you use PNGs for gradients and background textures and have more than a few across your site, then decide to adjust the color scheme you'll have to manually modify the PNGs. With CSS gradients you simply change the color values. This is especially time-saving if using something like LESS which allows CSS variables and mixins.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Nov 2013 18:13
xcept: Would it really take that long to edit a PNG? Granted it would probably be quicker to type in new colours, but still it's only going to be a minute or so for a simple image and then job done.


Formerly OBese87.
mr Handy
16
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 6th Nov 2013 19:32
Quote: "then decide to adjust the color scheme you'll have to manually modify the PNGs"

Good point! But, except forums, I've almost never seen this in use.

Login to post a reply

Server time is: 2024-05-19 14:06:21
Your offset time is: 2024-05-19 14:06:21