python mimes css!! MAUAHAHAH

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

python mimes css!! MAUAHAHAH

Post by Isaac » Fri Jun 24, 2011 9:00 am

http://testing.isaacg.net/csstest/

This is great for me. I hate css problems between platforms.

I will later attempt to make a converter that takes one css file, made for a single browser, and convert all its syntax and style to the browser visiting.

It will also convert png transparencies into gifs, when necessary, via imagemagicks.

It could also resize images for mobile devices, via imagemagicks.

Any reasoning why this is a waste of time? I have yet to see a better solution for css problems.

edit:
In theory, this is how you'd tell python which css file, or files, to use.
...HREF="mycsspage.cgi?file=mycssfile.css".....
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6387
Joined: Sun Sep 05, 1999 2:01 am
Location: ☃☃☃

Re: python mimes css!! MAUAHAHAH

Post by Jeff250 » Fri Jun 24, 2011 12:31 pm

type="text/css" => mime type is text/css.
Isaac wrote:Any reasoning why this is a waste of time? I have yet to see a better solution for css problems.
It's better to handle this on a case-by-case basis for your specific application rather than try to write a general converter. Also, png's colors are 32-bit, 24 bits for RGB and 8 for transparency, whereas gif's are only 8-bit paletted, where one of the 2^8 palette possible colors can be chosen to be 100% transparent and all of the others are 100% opaque. In other words, png -> gif creates massive information loss.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: python mimes css!! MAUAHAHAH

Post by fliptw » Fri Jun 24, 2011 1:53 pm

for PNG transparency: http://24ways.org/2007/supersleight-tra ... png-in-ie6

if you want a website to look good in all browsers, then you have to, as jeff said, do it on a case-by-case basis - other wise you will end up with it looking so-so for browsers other than the one you test on.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: python mimes css!! MAUAHAHAH

Post by Isaac » Fri Jun 24, 2011 2:23 pm

That's true, according to everything else I've read, Jeff and Flip. Each css setup should be geared for a specific browser and, sometimes, version. However, python can do that too! It can easily detect what the user agent is and perform the same function. The great part is, you don't rely on the user's browser to make the decision on what css file to use. Python makes the decision.

PNGs to GIfs won't ever be a perfect match. Yeah, Flip, thanks. I'll have to try those out. Also there's a chance Imagemagicks can reproduce the PNGs' background color so that it does not need to be transparent, though this could cause other problems. I think PNG conversion would only happen on clamshell phones, and other extreme cases. I'm not too worried about full featured desktop browsers.

I'm going to try this out. I mean, this is a pretty easy script to write. I just have to build a large list of syntax with rules.
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: python mimes css!! MAUAHAHAH

Post by fliptw » Fri Jun 24, 2011 3:33 pm

For platforms like clamshells, if anyone does browse on something that small, I'd just feed a site thats just text.

There is no way to really match what the user sees as the background colour.

Just... don't use imagemagik.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: python mimes css!! MAUAHAHAH

Post by Isaac » Fri Jun 24, 2011 4:10 pm

I think playing on my little nokia is great. It's such a primative device, but with python, I can have all kinds of stuff work with it. CSS styled text and gifs run pretty well with it.
fliptw wrote:Just... don't use imagemagik.
Oh, you don't like it?
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: python mimes css!! MAUAHAHAH

Post by fliptw » Fri Jun 24, 2011 4:19 pm

Its perfectly fine; its not a tool to magically make websites "just work" on a given platform.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: python mimes css!! MAUAHAHAH

Post by Isaac » Fri Jun 24, 2011 4:41 pm

Oh, of course not. It's a command line graphics tool, that happens to be magical.
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6387
Joined: Sun Sep 05, 1999 2:01 am
Location: ☃☃☃

Re: python mimes css!! MAUAHAHAH

Post by Jeff250 » Fri Jun 24, 2011 7:13 pm

You could probably make sniffing user agents and outputting variable CSS work, but it's not the most robust way, especially since user agent strings are not always reliable. Besides, this is already a solved problem. Link to the *.css file containing your IE-isms inside of IE conditional comments. Most other cases are something of the form (to borrow your example from the other thread):

Code: Select all

background-size: cover;
-webkit-background-size: cover;
-o-background-size: cover;
-moz-background-size: cover;
Unless you're a purist, there's no harm in Firefox seeing the -webkit-foo style (and vice versa), so you can put all of them in the same *.css file. They were specifically designed with this in mind.

For clamshell phones and the like, see the "media" attribute on the link tag. Like Flip said, you shouldn't strive for pixel-perfect replication on them.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: python mimes css!! MAUAHAHAH

Post by Isaac » Fri Jun 24, 2011 7:54 pm

True. I've been doing that, trying to get things to align the same way form one browser to the next. And there's a basic html tag that can let me make a separate css file for each type. I don't think more than three css contingencies is necessary, but I've seen examples that have many more than that.

There's also something called a reset sheet, but the concept is strange and it seems like it complicates things more.

I was once looking for a css compatibility script. I figured someone would have made one by now, since it could potentially eliminate, if done correctly, cross browser checking. I thought jquery, with its javascript cross compatibility features, would go into making css more cross browser friendly. Though there are css features in jquery it makes no adjustments for css between browsers.

Where I stand I can either,
1. work on something else and just learn basic work arounds, regarding css. It's also what I think you guys are implying I should do, meaning it's probably the best decision and what I should do. I'd rather be making my jQuery/Ajax/Python RPG.
2. I can make a javascript css converter, which I think has the highest potential of being used by others.
3. I can make a python css converter, which I think will work better than javascript, and for any platform.

After writing that list above, it makes more sense that I pick 1.
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
Jeff250
DBB Master
DBB Master
Posts: 6387
Joined: Sun Sep 05, 1999 2:01 am
Location: ☃☃☃

Re: python mimes css!! MAUAHAHAH

Post by Jeff250 » Fri Jun 24, 2011 10:53 pm

Aside from IE-isms, cross-browser CSS shouldn't even be a big problem. If it is, you might be trying to use too much experimental CSS3 stuff. For now, try to mostly stick with CSS2 stuff. Sometimes you just have to shrug off cool new CSS stuff until it's more widely supported.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: python mimes css!! MAUAHAHAH

Post by Isaac » Sat Jun 25, 2011 5:35 am

Yeah, ok. I'll need to watch out for css3 stuff. Right now I'm just plugging in anything that works without any real thought, into my CSS file. I guess that's where all my trouble is coming from.

Thanks for the advice!
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
Post Reply