| The Useful, the Usable and the Unbelieveable in Design for the Web | |||
In This Issue...
The JavaScript Anthology: 101 Essential Tips, Tricks & Hacks
"Take Control With the Ultimate JavaScript Toolkit".
Introduction
April is here, and don't internet geeks love an April Fool's Day prank? At sitepoint.com you may have come across Matt Magain's contribution to prankery, ' Build Your Own Web 2.0 Application Using Fluff and Hot Air, and no doubt many SitePoint Forum junkies got a rude shock when they were asked for their credit card details when starting a general chat thread.
It hasn't been all back-slapping and guffaws though. We added a new tab to the site for the first time in years. In case you're not familiar with 'Marketplace' yet, I thought I'd show you how you can put it to work for you. I've also been working on a little CSS experiment which the guys dubbed 'Spanky Corners' -- it's rounded corners with clean markup with no JavaScript required. It's still a little raw, but with some more polish I think it might prove handy for a lot of people. Check it out. Cheers,
Alex Walker
Step Right Up!Web forums are funny things -- sometimes they develop a life and mind of their own. The SitePoint Marketplace has developed, in only a few years, from a trickle to a raging torrent of activity. Today users are trading everything from $5 domain names to $100,000 online businesses. What has this got to do with you, the designer?
The process is fairly straightforward :
Our own Web Services Team, SitePoint Solutions, has been obtaining some excellent results for their clients using the Marketplace, and have gone on to establish important ongoing relationships with some of the designers they've worked with there.
No, it depends on the prize money that's being offered. You get what you pay for right? Remember though that you're only paying for the best design at the end of the contest, and if you're not happy with any of them, you don't have to pay a cent. On the flip side... If you're a budding designer looking to build your portfolio, gain exposure, source leads for your freelance business, or just make some spare cash, the "Design Contests" are just the thing! It has the potential to become a valuable resource for any design company.
Spanky Corners: Right Round, BabyIf you spent time last week reading the blogs, you would probably have seen a spirited discussion on Greg-J's SpiffyCorners.com and good markup vs. getting results. Greg was even good enough to give us his views. The executive summary: SpiffyCorners is an online generator that allows easy production of rounded corners on content boxes (DIVs). The main 'bone of contention' in our discussions, was that the curve is achieved using fairly heavy markup that only exists to make the effect work -- in this case, hardcoded empty <B> tags. Obviously we wouldn't recommend this for exactly the same reason that most of us have stopped using TABLEs for layout -- markup was invented to make our content make more sense than plain text. Bad markup does just the opposite. To my mind, there is an obvious reason why SpiffyCorners has caught the imagination of many despite these issues. It provides a solution that works. While many web standards advocates (myself included) are quick to tell you what you shouldn't do, they don't necessarily always tell you what you should. At the end of the day that doesn't help you to deliver a site to your client. With that in mind, I thought I'd experiment with a semantically-solid alternative to SpiffyCorners and share the results with you. Around the office this has become affectionately known as 'Spanky Corners'. Spanky CornersHere's the markup I want to start with:
That's about as succinct as you can get.
The heading is a requirement. It doesn't have to be an The problem we've always been stumped by with rounded corners is that you need four 'hooks' for your four corner images, and there simply don't seem to be enough (hooks). To get around this, we're going to have to brutalize CSS-2, forcing it to do something it doesn't want to -- although it will validate fine. I've created some example pages that allow us to build a rounded box on the above markup corner-by-corner.
ProWorkflow - The Business/Project Dashboard for Web Design Firms and Freelancers!
ProWorkflow is customisable and expandable to suit your business and is available in two flavours: subscription account or permanent license to run on your own server. Click here to view our Free Online Demo or start your 14 Day Trial.
Let's start with the obvious stuff. After resetting all paddings and margins to 0, add the bottom-left corner graphic to your DIV and give the DIV margins. To make the example more real-world, I've floated the DIV and limited its width to 48%, but the DIV could be full width if you wanted.
The result is simple and predictable. It's still like shooting fish in a barrel at this point, as we add the top-right corner graphic to the top-right of our H4 heading:
To nail the bottom-right corner we have to start getting crafty. In theory, we do have some markup down there to 'hang' our corner on -- the last <p> in our <DIV>. The problem is that we've got too many of these. If we add the graphic to one <p>, we add it to them all. So what if we did add the corner to every <p>, but we used a negative margin on the bottom to make them overlap enough to hide the corner graphic? Just like overlapping playing cards, the bottom <p> would be the only one that we could see in full (see diagram).
So if our corner graphic is 26px high, a -26px margin on the bottom of
the
Now although our negative margin does a good job of hiding our corners,
it also obscures some of our text. That's why we need to add 26px of
Of course if you expect that your boxes might finish with a H5, H6 or other tag, you can apply the same trick. I've applied it to the P, the H5 and the PRE tag in this example. That's three down. One to go. So now we're one corner short, but we've used up all our markup hooks -- the DIV, the H4, the Ps. We've used up all of the available background image attributes (the DIV, the H4, the Ps and the H5), so we are going to have to think outside the box, rather than adding another one. Q: What is the only full CSS2 object that can handle two images?
A: The list item. It has access to a
Although we don't actually have any lists on our page, that doesn't
prevent us from accessing its listy specialness. Switching our H4
from its default Here's the updated H4 styling.
div.rounded h4{
Along with setting the list-style image as our top-left corner graphic,
we have to make some other minor adjustments. The postion that our list
image sits in relative to its text varies between browsers, so using
Load that up, and BAM! We have a happy, four cornered result in IE6, IE7, Firefox 1.5, Opera 8 and Safari 1.3.2. Even on the older browsers things are amazingly close to working. IE5 and IE5.5 on PC, and IE5 MAC both get all but one corner perfect.
IE's Conditional Comments allow you to target only those browsers without resorting to hacks. Though it may be possible to fix the issues, for this example I'm recommending that you simply create a linked stylesheet that 'undoes' all your corners in those browsers. In my view, square corners in those oldies is no huge sacrifice.
Are there any issues to look out for?Like any new method, 'Spanky Corners' has not yet been put through the mincer of everyday use. Undoubtably quirks will emerge as time moves on. We have found that there is occasionally a funny 'jog' issue on the left side when resizing in IE6+7. Zooming the text and shrinking the browser way, way down break the corner positioning if you go far enough, but it certainly doesn't effect readability significantly. Otherwise it seems pretty robust. Spanky Corners: Code Generator (beta)
With some help from Lachlan, Kev and Tom, we are working on a 'Spanky Corners Code Generator - beta'. It doesn't work properly -- yet. Developing the algorithms that work in all situations is certainly more demanding than making it work in one example, however you're more than welcome to experiement with it while we finish it. I'll blog about it when it's 'battle-ready'. Repeat: I doesn't work 100% correctly yet. We should have the bugs out of it in a day or two. Have a play, watch it develop and let us know what you think. P.S. Also a very big thanks to Julian and the guys at ProWorkflow for their patience as we held back the Design View to get the generator online. Much appreciated. Cheers, Read the blog entry:
That's all for this issue -- thanks for reading! I'll see you in a few weeks.
Alex Walker
Help Your Friends OutPeople you care about can benefit from the wealth of information on new and maturing technologies available on the Internet. Help them learn how to do it by forwarding them this issue of the SitePoint Design View! |
Download free chapters from every SitePoint Book!
The JavaScript Anthology: 101 Essential Tips, Tricks
& Hacks
The Best Structure for your Flash Site
Few developers know how to use Keyframes, ActionScript, and MovieClips, and can control the Flash playhead to their advantage. Optimizing your use of these elements can help you reduce file size, minimize download times, and create efficiencies that make altering your work easy. Mark shows how it's done in this comprehensive tutorial.
Fire your Boss! The Successful Home Freelancer's Guide
Sick of the commute? Tired of working for The Man? Want to establish your own freelance consultancy? Here's the kick-start you've been waiting for! Neil and Jarvis help you assess whether you're cut out to run your own business, and show you how to recognize, understand, and address risk. Finally, they provide an all-points primer to help you set up a functional home office that supports your creativity *and* your bottom line.
Build Your Own Web 2.0 Application Using Fluff and Hot Air
So you have a great idea that you want to turn into the Next Big Thing? Well, jump aboard the Web 2.0 bandwagon! The momentum that's building behind web applications means there's never been a better time to start reaping the rewards of your hard work.
Improve Usability for Older Users
A growing portion of the population is over 60 -- and online! Tim reveals his first-hand research into the ways people aged 60+ use the Internet, and what it means for designers and developers.
Script Smarter: Quality JavaScript from Scratch
If you've avoided JavaScript, or only knew it in its previous "toy language" incarnations, now's the time to step up and get to know the newer, smarter JavaScript. This hands-on tour will get you started with JavaScript before illuminating the ways in which the DOM can be utilised via JavaScript, the practicalities of pop-up windows, and how JavaScript can work within a web page to produce slick DHTML effects.
DHTML & CSS Blog:
Selling Web Design
Services Blog: Flash Blog:
Design
Blog:
Search Engine
Marketing Blog:
|
||
|
Manage Your Subscription Here.
SitePoint Pty. Ltd. Thanks for reading! |
|||
|
© SitePoint 1998-2006. All Rights Reserved.
|
|||
Design, coding, community or marketing? Select the right newsletters right for your needs...