CSS layout tricks

Filed under: Blogging, Development, Geek, Techy stuff — kathyjay at 8:08 pm on Wednesday, May 31, 2006

As documented yesterday, I managed to get the ‘acorns’ in the left-hand navigation bar fixed but had to take them out of the right-hand bar because I couldn’t replicate the trick. A little midnight musings brought the answer.

The code for the left-hand navigation elements is adapted from gavlinne’s original suggestion on the webdev journal:

div#nav-left ul#nav {
padding: 0;
margin: 0 0;
list-style-type:none;
}

div#nav-left ul#nav li {
margin-left : 25px;
float : left;
}

/* Hide hack from IE5/Mac \*/
* html div#nav-left ul#nav li {
margin-left: 12px;;
}

div#nav-left ul#nav li a:link,
div#nav-left ul#nav li a:visited,
div#nav-left ul#nav li a:hover,
div#nav-left ul#nav li a:active {
color : #813817;
text-decoration : none;
display : block;
padding : 7px 5px 7px 35px;
margin: 0;
background: url(images/acorn01.gif) no-repeat left center;
}

div#nav-left ul#nav li a:hover,
div#nav-left ul#nav li a:active {
text-decoration : underline;
}

This all forced IE to see the ‘acorns’ my specifiying all the states of the a: tage and works perfectly well for a single-level navigation bar. In this blog, the right-hand navigation bar has multiple layers and for once IE displayed them as I intended when using this code, but Firefox didn’t. That’s actually a sign of IE playing up rather than Firefox, because Firefox quite rightly got confused by the float:left and sent things everywhere. The code above had an extra layer of ‘ul li’ added to anything that originally stated ‘ul li’, but there was nothing clearing those floats so the first layer of the list confused itself.

The trick was a slight adaptation below (in bold):

div#nav-right ul {
padding: 0;
margin: 0 0;
list-style-type:none;
}

div#nav-right ul li {
clear: both;
padding-top: 20px;
}

div#nav-right ul li ul {
padding-bottom: 20px;
}

div#nav-right ul li ul li {
margin-left : 25px;
float : left;
padding-top: 0;
}

/* Hide hack from IE5/Mac \*/
* html div#nav-right ul li ul li {
margin-left: 12px;
}

div#nav-right ul li ul li a:link,
div#nav-right ul li ul li a:visited,
div#nav-right ul li ul li a:hover,
div#nav-right ul li ul li a:active {
color : #813817;
text-decoration : none;
display : block;
padding : 7px 5px 7px 35px;
margin: 0;
background: url(images/acorn01.gif) no-repeat left center;
}

div#nav-right ul li ul li a:hover,
div#nav-right ul li ul li a:active {
text-decoration : underline;
}

That was the only adapatation needed and it worked like a dream. A little bit of fiddling with padding to ensure that the category headings don’t bump into each other, and the navigation is now working as intended in IE6, Firefox and Opera.

Although I suspect that it still explodes nicely in IE7.

Fixed!

Filed under: Blogging, CSS, Development, WordPress — kathyjay at 7:08 pm on Tuesday, May 30, 2006

With a little help from a friend, I managed to fix the acorns in the left-hand menu! It turns out that IE gets thoroughly confused occasionally and needs some elements specified in the CSS down to the nth degree before it will work properly. Sadly, I haven’t been able to replicate the same trick on the right-hand menu so I’ve done a little hacking around so that the right-hand menu has no acorns. Poor, deprived menu.

The acorns are still there in all other sensible browsers, though.

That trick also doesn’t work with the blog post titles, so they’re still being hacked around to work dully in IE and work in full, maple-leaf glory in Firefox, Opera etc.

One day, Microsoft will release a browser that actually does the same things that other browsers do and we’ll be able to junk all the hacks. Until that day, we just have to find new ways to work with the ‘undocumented features’.

Blog skinning

Filed under: Blogging, CSS, PHP, Website work, WordPress — kathyjay at 1:51 pm on Monday, May 29, 2006

I have spent a productive Bank Holiday weekend skinning this blog so that it now matches the rest of the site. Happily, it turned out to be much easier than I’d thought because WordPress is so well designed.

The re-work did require a few minor tweaks to the main site layout, turning it from a two-column layout to a three-column layout so that everything would fit well. A List Apart came to my rescue with this great article on three column layouts with liquid centre column and fixed sidebars. I was actually going there for something else, but when I spotted the article titled “In Search of the Holy Grail” after seeing several similar articles over the last few months, I had to give it a try. And the best bit is that it works in IE6 (with a hack or two), Firefox and Opera. I’m informed that it explodes nicely in IE7, though, so hopefully the community will be coming up with a few hacks to get around Microsoft’s latest insanity.

In fact, the only thing that the new layout doesn’t do properly is the little acorns in the left-hand navigation bar and ocassionaly in the right-hand bar. They display perfectly in Firefox and Opera, but randomly disappear in IE6. Damn.

If you’re viewing this in IE6, you will also miss the lovely little maple leaf motifs that decorate the post titles because, again, IE6 is randomly not displaying them. So I used a hack to pull those out and align the post titles properly. Firefox and Opera users can see the blog in its full glory.

Of course, I didn’t spend the entire weekend buried in code because that would be far too geeky. Nope, I braved the mud yesterday to venture into the local woods for a bit of a walk and a photo opportunity - it’s rhododendron season and I couldn’t resist. I will hopefully be updating the gallery with some results soon. But playing around with PHP, XHTML and CSS for a weekend after weeks of only seeing VBA and SQL at work was actually a lot of fun. I really am turning into a sad geek :-)

A little upgrade

Filed under: Development, PHP, Website work — kathyjay at 3:41 pm on Friday, May 19, 2006

Having a day off is always pleasant, although I always seem to end up doing useful things regarding websites rather than curlcing up in an armchair with a book. Ah, well.

In that useful things category, I have PHP-ed Above the Fold. It now has navigation, headers and footers neatly seperated out and modularised, making page creation that little bit simpler. A couple of ifs and switches allows me to feed titles and h2#id values into the header, personalising each page, and differenciate between different levels of navigation with ease. All that I now need to supply is a couple of variables and the includes and all of it is taken care of.

Maybe editing pure PHP files isn’t as “clever” as using a template class would have been, but for something this small it didn’t seem worth digging out the PEAR classes. Maybe when I start designing some new web apps for this site. Hmm

I also took the time to add a page for the Larren Art site. This lanched a couple of weeks ago and I’m very happy with the end result. You can read more about the design process in the Larren project page.

I am still humming and hawing about including a link to my fannish website on my CV. On the one hand, it’s host to my biggest and best web app - PHP/MySQL backbone, accessible, simple to use and surprisingly popular. It’s got login facilities for registered users and differing levels of access for the admin.

On the other hand, it’s fannish and doesn’t really feel “right” for a CV that’s supposed to be relatively serious.

A few minor snagging issues…

Filed under: Techy stuff, Work sillies — kathyjay at 6:34 pm on Wednesday, May 3, 2006

Snagging is a building term - it’s the faults and issues requiring fixing that are discovered during the handover of a new premesis. My stint with a development team for a housing association last year taught me that.

We have discovered some snagging issues with our move to the new site today. The biggest, from a health and safety point of view, is probably also the daftest.

The architect who redesigned our office area is obviously a fan of natural light. He had all those nasty florescent overhead lights taken out and the empty ports neatly covered over. We have lovely big windows that are wonderful on a sunny day. What did the architect forget?

Replacement lights.

Yes, if the sun goes behind clouds or, god forbit, it gets dark outside as it is wont to do in the evenings, we have no lighting. Ah. Facilities sees our problem, apparently. They’re going to see whether they can rustle up a couple of stand-alone lamps. Not a terribly practical solution due to the layout of the office (my desk, for example, will still be quite dark), but it’s a step there. We’re hoping they sort it out before winter because we won’t have many hours of usable sunlight…

Other issues, such as having no printers (nobody noticed that our department, which has been scattered on other sites for years, has none of its own), missing computers, insufficient electrical sockets and sauna-like heating seem fairly small in comparison.

Although the lack of kitchen facilities is annoying.

One missing computer did cause me some problems - it contains a program that fastloads data into our datawarehouse. I have a trial going on at the moment that requires a weekly data upload to the warehouse. Inserting over 50,000 rows of data from a text file takes a couple of days without this software. The reports for my trial should have gone out today. Someone is popping back to the old site with a car tomorrow so the reports should only be a day late.

Who says working for one of the biggest companies in the country ain’t fun?

« Previous PageNext Page »