Getting ready for an alpha release: CSS fixes

Nao

  • Dadman with a boy
  • Posts: 16,082
Getting ready for an alpha release: CSS fixes
« on August 31st, 2012, 11:13 AM »
Been busy IRL blah blah blah, worked on a few things that I wanted to fix in my CSS. Not happy with the things I've had to give up for that... So I want your opinion, because all of this has been accumulating over the last couple of days, and last time I checked, I really wanted to commit everything I have before I'm ready for an alpha.

1/

Gradients in headers (Wine and children): for a long time, what I used was a very small PNG image, which allowed it to work in IE6+. Recently, I decided to replace gradient images with proper gradients, as IE6 doesn't deserve any non-essential goodies anyway. So I did that.
Then I realized that an issue with linear-gradient, is that to get the same effect as an image, you have to specify color stops in pixels, and then set an explicit background-size... It's a bit complicated, but I did it. (Unfortunately, it also meant that the resulting CSS was probably on par with the earlier one in terms of size :P)
Okay, so this morning, I was thinking... "What the hell?! I could simply be using an inset box-shadow to act as the inner gradient! And I get to set my pixel dimensions!"
And it works fantastic. Really. It's just a single line of code. It works in IE9+, and it's cleaner.
However... There's a catch.
The performance is excruciatingly slow when there are lots of these, e.g. alternating backgrounds in the error log or display page. Really. Under Opera 12.5, it runs fine, just a bit less responsive, but when you show a confirm box, you can see how long it takes to show up... Under Firefox 16, it's like night and day. Super fast with a gradient, HORRIBLY slow with a box-shadow.

That's really, really annoying because the results are much better in box-shadow mode!
So... What do you reckon I should do? Is there a way to fix performance? I'm talking about a test done on a Core i7 computer... :-/

2/

Another thing that always bothered me... Wedge using JavaScript to reposition the sidebar, instead of media queries. This was originally because I would 'switch' positions between two different elements, so that I could set a specific target for the sidebar inside the DOM, instead of using CSS tricks to reposition it. As time went by, I decided to save bandwidth in all HTML pages by applying a 'responsive' ID to the DOM's top instead, and I hacked into the CSS in a relatively clean way that I was satisfied with. Okay, so far so good...
Now, this morning I was looking at my code, and the first thing that came to mind was, "WTF?! I use #responsive to set specific media queries... Why not just use @media $responsive?". And this is exactly what I did...
So, $responsive is set to a max-width of 1000px for now, it's working okay. The main benefit here is that because it's done on the CSS level, there's absolutely zero FOUC effect when reloading a page. (There used to be a very, very short one when doing a F5 refresh.)
Plus, I think themers will be comfortable with that... As long as they know about responsive design, of course.

Now for the drawbacks...

- @media doesn't have a set precedence factor, so it doesn't change priorities in the code, unlike #responsive. This means that if you set a #responsive #sidebar to 'display: block' in index.css (or even in an hypothetical extra.css file in Weaving), and then set #sidebar to 'display: table' in a sub-skin's extra.css file, the resulting responsive page will have #sidebar set to display:block because #responsive has higher priority. But if you start replacing all of these with @media $responsive, the resulting responsive page has #sidebar set to display:table because it was filled in after the original media query. The (clean!) solution I'm using, is to take the original media query, copy it at the end of my extra.css file, and add a reset suffix to it. Yes, "@media $responsive reset" is all that's needed. This way, the original media query is removed, and the new one is set at the one, and it includes the original media query's rewrites. Yes, it isn't as bulletproof as direct inheritance because if Weaving is heavily modified you'll have to modify your sub-skin as well. But it's probably something that could also happen with #responsive, albeit with different issues.

- Perhaps an even worse one... Unfortunately, @media being a special construct, you can have a selector like ".myclass, #myid, @media all .anotherclass", ah ah. Well, Wedge doesn't even bother checking... It actually does build such a selector if you add an 'extends' keywords to .anotherclass in the media query. Which pretty much makes the css declaration fail. So, yes, it does mean that whenever you start declaring a media query, *you can't use any extends in it.* Bummer!

So, I'm seriously considering going back to the 'original', as flawed as it is.

3/

And finally... The menu arrows.
Currently, they're using a lightweight (150-byte) image with horizontal and vertical positions, as well as a hover version.
I decided that I wanted to associate the arrows with the text next to them -- so that you can set the text to any color and they'll follow the color. So I replaced the arrows with CSS right-floated 'content' set to '\a0\25bc' (IIRC), in a pseudo-class of course. It seems to work really fine. This also allowed me to remove a couple of CSS hacks I had for the arrows. Unfortunately, this technique also has its limitations... Apart from the fact that pseudo classes don't work in IE6 (fuck you IE), there's the fact that Firefox shows arrows using a largely different size compared to Opera (?!), and float issues in the different places where it's all used, e.g. menu arrows aren't floated the same way when they're in the top-level menu or inside the menu itself. Same with linktrees...

This one is more of a technical issue to me, as philosophically I think I'm really good with using CSS content rather than images.
Anyone got any experience with that...?
Re: Getting ready for an alpha release: CSS fixes
« Reply #1, on August 31st, 2012, 05:29 PM »
Re: 1, I tested under all 5 main browsers, and only Firefox has big issues with box-shadows everywhere... Others work okay. With the fastest being Opera and... IE9, oddly!
Still, dunno if I'm going to do that for windowbg/postbg. It's probably best to keep my inset box shadows to places that don't repeat indefinitely on a page.
Re: Getting ready for an alpha release: CSS fixes
« Reply #2, on August 31st, 2012, 11:18 PM »
Was my post too long? Did anyone read it? Or have an opinion on any of these points..?
I'm just saying -- I myself find I don't have enough time to participate in all topics (I'm planning to play catch-up later, for now I'm just resorting to reading new posts via the Recent Posts feature), maybe I'm not alone...

godboko71

  • Fence accomplished!
  • Hello
  • Posts: 361
Re: Getting ready for an alpha release: CSS fixes
« Reply #3, on August 31st, 2012, 11:21 PM »
Quote from Nao on August 31st, 2012, 11:18 PM
Was my post too long? Did anyone read it? Or have an opinion on any of these points..?
I'm just saying -- I myself find I don't have enough time to participate in all topics (I'm planning to play catch-up later, for now I'm just resorting to reading new posts via the Recent Posts feature), maybe I'm not alone...
Been stuck on site all day so not had a chance to read and reply. I apologize.
Thank you,
Boko

Jntg4

  • Go Cubs Go
  • Let's Go Hawks!
  • Posts: 8

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Getting ready for an alpha release: CSS fixes
« Reply #5, on August 31st, 2012, 11:28 PM »
I read it, I just don't really understand what the consequences of these things are in practice.

What I can say is that:
1. No matter how pretty it is, if it's visibly sluggish on an i7 box, let it go.

2. How much of a *practical issue* is the inability to use extends on a media query? What would you actually want to do that it would prevent you from doing?

3. I'm not sure it's worth the effort. The only thing that strikes me as relevant is the fact that some people like the style of linktree like XenForo uses, where you have a container and capsules with > ends that are highlighted on hover. Can this be done in the current setup just in CSS? Would it require a change in markup? Would the changes in markup that might be required also make this possible?


(also: I got the new replies warning)
Quote from Jntg4 on August 31st, 2012, 11:22 PM
It was lengthy, but glad to see a lot of progress towards an alpha!
Yes, 2 years is a lot of progress towards an alpha.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Getting ready for an alpha release: CSS fixes
« Reply #6, on September 1st, 2012, 12:09 AM »
Quote from Arantor on August 31st, 2012, 11:28 PM
What I can say is that:
1. No matter how pretty it is, if it's visibly sluggish on an i7 box, let it go.
Been doing lots of tests, and really it's only sluggish on Firefox... Dunno what they got wrong when implementing box shadows.
Box shadow gradients are visibly *better looking* than linear gradients, so it's really tempting to stick to them. (Plus, IE9 supports box-shadow insets, while it ignores linear gradients.)
I could simply add a hack to extra.firefox.css to reset the box-shadow and use gradients instead just for that browser...
Quote
2. How much of a *practical issue* is the inability to use extends on a media query? What would you actually want to do that it would prevent you from doing?
Well, just as I mentioned... I tried doing an extends .inline-block on an element inside the media query, but it wasn't correctly compiled.
So I had to stick to using 'display: inline-block' on it. It's all fine on IE because inline-block was supported before media queries were implemented at all, but I'm attaching respond.js for these, which adds support for MQs, uh...
Anyway, it was just an example. I guess that in a common situation, you wouldn't need to extend MQ stuff because you'd want to try and keep it simple.

What's your favorite solution? (1) JS to finely tune the positioning of the sidebar (swapping it with another div, original implementation), (2) JS to add a #responsive class (selector order is easy), (3) JS-free classic media queries (have to be careful with selector order).
Quote
3. I'm not sure it's worth the effort. The only thing that strikes me as relevant is the fact that some people like the style of linktree like XenForo uses, where you have a container and capsules with > ends that are highlighted on hover. Can this be done in the current setup just in CSS? Would it require a change in markup? Would the changes in markup that might be required also make this possible?
I don't think you'd need to change the markup at all... Basically, it'd work whatever the current CSS is. You just need to 'cancel' it and replace it with your own. (These days, most kinds of shapes can be achieved with multiple box shadows or linear gradients, so that would be very much doable...)
Quote
Yes, 2 years is a lot of progress towards an alpha.
...You're not helping, you dirty b'stard :P

Jntg4

  • Go Cubs Go
  • Let's Go Hawks!
  • Posts: 8
Re: Getting ready for an alpha release: CSS fixes
« Reply #7, on September 1st, 2012, 05:35 AM »
Quote from Arantor on August 31st, 2012, 11:28 PM
I read it, I just don't really understand what the consequences of these things are in practice.

What I can say is that:
1. No matter how pretty it is, if it's visibly sluggish on an i7 box, let it go.

2. How much of a *practical issue* is the inability to use extends on a media query? What would you actually want to do that it would prevent you from doing?

3. I'm not sure it's worth the effort. The only thing that strikes me as relevant is the fact that some people like the style of linktree like XenForo uses, where you have a container and capsules with > ends that are highlighted on hover. Can this be done in the current setup just in CSS? Would it require a change in markup? Would the changes in markup that might be required also make this possible?


(also: I got the new replies warning)
Quote from Jntg4 on August 31st, 2012, 11:22 PM
It was lengthy, but glad to see a lot of progress towards an alpha!
Yes, 2 years is a lot of progress towards an alpha.
Ya, I probably should have said something about the imminence instead.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Getting ready for an alpha release: CSS fixes
« Reply #8, on September 1st, 2012, 08:13 PM »
Okay, bump...

I'll try to use clear English for my questions (for everyone.)

1/ What kind of sidebar do you want to have when you reduce the width of your window?

a- The same sidebar... Fuck small windows, fuck mobile! Don't touch it ah ah ah. (This has no impact on anything else, obviously.)

b- Move it below the content, and if possible above the footer. (Uses @media -- this has an impact on how you can write media queries. You simply can't use inheritance or odd little things in media queries -- has to be mostly 'clean' CSS code.)

c- Move it below the content, and if possible above the footer, using JavaScript. (Uses #responsive ID insertion -- this has an impact on performance, i.e. when you load the page in a small window, you might see the un-modified sidebar show up for a few milliseconds before it goes to the footer.)

d- Move it just above the footer, whatever the internal CSS or HTML layout. (Uses DOM manipulation with JavaScript -- this is the cleanest solution, but has the same 'sidebar flash' as solution (c), and uses a few more bytes of JavaScript code at the end of your HTML.)

2/ Do you prefer the idea of having menu arrows (and linktree arrows etc) as HTML content, or as background images? (Both have their pros and cons. It's mostly a philosophical question, like do you believe John Carmack exists?)

Drunken Clam

  • Drool, drool, drool....!
  • Posts: 154

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
The way it's meant to be

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

Dr. Deejay

  • Happy new year all!
  • Posts: 118

godboko71

  • Fence accomplished!
  • Hello
  • Posts: 361

nolsilang

  • Lurking <i class=
  • Posts: 106