One problem with using divs with background images instead of proper imgs is divs don't have an exact equivalent of the "alt" tag, for screen readers and webcrawlers.
I found a coworker using "text-align:-9999px;" for the div -- this moved the text off the page but allowed him to use an image instead. (He was concerned about some of the nuance of the font and character rendering.)
It's a clever idea, but I think not a good practice. It smelled a bit off to me, and as I research it I see some bots like Google consider it a bit of a red flag.
A good trick to know of, but I'm not recommending it.
Thursday, July 26, 2012
Sunday, July 22, 2012
the alleyoop "ignite" hackathon
![]() |
| the design for the hackathon shirts-- best corporate shwag ever? |
The schedule for such a hackathon was/is as follows:
- The week before: people think of an improvement or new feature for our site/product.
- Wednesday afternoon: people give 2 minute pitches for their idea, and everyone has three votes (represented by a post-it to attach to the pitch's title sheet). Each of the top 4 post-it getters than have a crossfunctional team formed for it, captained by the person who pitched the idea.
- Next 48 hours: people discuss, code, and user survey like crazy to validate the concept and see how much of it they can put into action. We had students in to user test and give feedback, and various Mentors to provide constructive criticism.
- Friday late afternoon: each of the 4 teams gives a 5-minute presentation and has 5 minutes of Q+A. Then, the judge (Patrick, our President) goes out to mull over what he's seen and pick a winner, and also each participant gets to vote for any team except there own as a "People's Choice" winner.
I pitched an idea: TTT, "Typing Topic Targetting" (letter expanded to 4 "T"s to include Textbooks)... and my idea got picked by my peers. It was right-sized to be able to get big bang for the buck, fast (my experience with other hackathons and gamejams has taught me the value of aiming... well, not low, but in a way that assure you get value for money.)
The rationale of TTT was that since earlier word clouds had shown that visitors on the site were able to type in just what were looking for, math-help-wise, we should leverage that ability to get them more quickly to the topic they wanted help on, rather than forcing them to navigate through the hierarchical taxonomy of math that the site had to offer.
My team was appropriately small, consisting of me (as captain and coder), Ari (who is interning here this summer) and Vincent-- we also had design support from Tom. We came up with mockups quickly to put in front of the students who were coming in to test things, and then did online surveys with Survey Monkey and click/label tests with Verifyapp.com. I also toiled away on a functioning prototype for the final presentation -- experience had shown that functioning demos impress judges.
![]() |
| search on keywords, hover for a view of the topic |
We ended up building a nice interface for that, where you could either scroll through the table of contents and click your current section, or type in a page number and it would do the scrolling and clicking for you. We also showed a concept that would take the user directly to the first recommended activity, the core idea being the quicker we get people to what we have to offer in the context of just what they're looking for, the better off everyone is.
On the final day, we had a bit of time to polish up our presentation. Ari made a slick Prezi presentation, and we rehearsed until we had our 5 minutes down cold, explaining the benefits of our feature in terms of user onboarding and retention, a summary of the research we had done, and showing off our demo of the tech. (Part of the trick is to cut away all the extraneous padding, and then have one person pick up RIGHT when the other person drops off, a trick a mentor suggested as the "Radiolab" treatment.)
In the end, I'd say Team TTTT was a big success. We didn't score as the first place judge's pick, but we did get the second place "People's Choice" award - not bad for a plucky little 3 person team. (The winning team had 8 or so folks from all parts of the company, a beautifully faked online demo, and an intriguing idea.) Plus, all 4 ideas are being integrated into the real site.
Other groups in Pearson have showed interested in the hackathon, both the results (especially in my take on search UI) and in the process itself. I learned that a UI coder shouldn't build his or her own search engine under a tight deadline...
Anyway, I purposefully made the tech demo portable, and you can see and play with it on my personal website. The search and textbook sections are active, though there's a fair amount of fakery going on. ("Any sufficiently advanced technology is indistinguishable from a rigged demo ") I like the way kinetics of the search came out, and Tom did a nice job with the look and feel.
Not bad for half a week's work!
Tuesday, July 10, 2012
simple buttons for simple minds
Just a random note, as long as you don't mind cutting off IE8, you can get pretty decent button-looking divs in CSS now, with something like
<style>
.simpleButton{
box-shadow: 0 0 3px 3px #888888 inset;
border-radius: 7px 7px 7px 7px;
width:150px;
text-align:center;
}
</style>
You can get
Attractive, and easier and more flexible than using a background image.
<style>
.simpleButton{
box-shadow: 0 0 3px 3px #888888 inset;
border-radius: 7px 7px 7px 7px;
width:150px;
text-align:center;
}
</style>
You can get
Testing
It even works as a button:
Attractive, and easier and more flexible than using a background image.
Wednesday, June 27, 2012
quick note on tables
I've been slammed at work and not updating this site as much, though I have two biggish posts planned: a followup to my previous discussion about table layout, and the results from a hackathon my company ran the other week.
So I have put out arguments that tables solve more problems than they cause, but the accursed IE8 through up a counterargument... in short it looks like using colspans on rows before rows with items that have set widths may lead to frustrating results. A temporary fix was moving the "offending" colspan to its own table, but I refer my future self to this stackoverflow discussion that describes how setting "table-layout:fixed;" and a placeholder row explicitly setting widths, before the colspan, seems to lead to the correct behavior.
So I have put out arguments that tables solve more problems than they cause, but the accursed IE8 through up a counterargument... in short it looks like using colspans on rows before rows with items that have set widths may lead to frustrating results. A temporary fix was moving the "offending" colspan to its own table, but I refer my future self to this stackoverflow discussion that describes how setting "table-layout:fixed;" and a placeholder row explicitly setting widths, before the colspan, seems to lead to the correct behavior.
Tuesday, June 5, 2012
a sinking feeling about floating
I sometimes worry that I'm making what an old boss coined a CLM (career-limiting-move) by publicly declaring my irritation with floating divs vs tables.
My preference for tables is a a hangover from my paleolithic web roots, I'm afraid, but I'm not convinced modern html5-based design provides a solid alternative for flexible grid-based design. Floated divs certainly have advantages (in flexiblity, readability, division of form from content) but "always having things stay where you'd expect them to" isn't among them.
Case in point: here is some CSS and its rendered result when applied to a wrapper div and 6 children, color coded for your convenience:
<style>
.floater_wrapper {
background-color:#cccccc;
width:160px;
height:58px;
}
.floater_wrapper div{
float:left;
width:40px;
height:20px;
margin:4px;
text-align:center;
}
.floater_wrapper div:hover{
margin:2px;
border:2px solid white;
}
</style>
Simple enough, right? Float divs, and add a border when hovered. And in general it works ok... except on Firefox and Chrome, if you happen to have changed the page zoom (like by pressing ctrl-+) up a notch. In that case when you hover over 3 the floating changes, the box 4 jumps to underneath 3, and 5 and 6 get pushed down a row, outside of the box.
I'm not sure exactly what's going on, in terms of why the "4" thinks "2" is lower than "3" and so it floats against that-- I assume the screen zoom is putting in rounding errors. This particular case is easily remedied by not changing the margin when hovered and giving the non-hover state a transparent border, rather than assuming a 2px border plus a 2px margin is the same as a 4px margin.
So this case had a simple fix, but the non-intuitiveness and obscurity of the error (in terms of the page zoom) gives me pause. A radical change in structure like that is just not something you would have seen in a table-as-layout solution. Just to get it out of my system, I'd like to write a few more advantages caveman-tables-for-layout have over floating divs. (Which is the fairest way of putting it, I think: people who say the argument is "tables vs css" are being grossly unfair.)
Eric Meyer, in 2009, put it pretty well:
I can see the advantages that floated divs can have: like in today's example I didn't need to pollute the numbered divs with table structure layout, and programmatically it would have easier to just keep on adding in divs, rather than having to coordinate the row structure. (and yeah yeah yeah, tables are for tabular data and using them for layout is the anti-thesis of proper html5 semantic thinking.)
But on the flipside, the wrapper in this example had a fixed height, in part because a container div will collapse if all its contents are floated (hence things like the clearfix hack... and don't get me started about some of the disgusting stuff I've seen to get columns to line up!)
Finally, beside my love of colspans and rowspans and what not, it's a lot easier to throw a "border" onto a misbehaving table you're trying to construct than to get a visualization of errantly interacting floating divs!
I'm swimming against the tide of design history here, I know, but until I learn of a better way to get grid-like behavior on a webpage, tables are going to be part of my web design arsenal.
(Quick followup as I ponder this a bit more: I do realize responsive design is generally a lot harder with tables, because of the mix of form and content. Most of what I really count on tables for, though, is not in the "whole page" style of layout, but for individual smaller widgets, where you really don't want things jumping around, and for them to keep their general relative positions. That's actually one of the paradoxes of responsive design: usually you want layout things to stay the same, no matter how the content changes, but with responsive design you finally want things to shift when the content seems to big for the space allotted...)
My preference for tables is a a hangover from my paleolithic web roots, I'm afraid, but I'm not convinced modern html5-based design provides a solid alternative for flexible grid-based design. Floated divs certainly have advantages (in flexiblity, readability, division of form from content) but "always having things stay where you'd expect them to" isn't among them.
Case in point: here is some CSS and its rendered result when applied to a wrapper div and 6 children, color coded for your convenience:
<style>
.floater_wrapper {
background-color:#cccccc;
width:160px;
height:58px;
}
.floater_wrapper div{
float:left;
width:40px;
height:20px;
margin:4px;
text-align:center;
}
.floater_wrapper div:hover{
margin:2px;
border:2px solid white;
}
</style>
1
2
3
4
5
6
Simple enough, right? Float divs, and add a border when hovered. And in general it works ok... except on Firefox and Chrome, if you happen to have changed the page zoom (like by pressing ctrl-+) up a notch. In that case when you hover over 3 the floating changes, the box 4 jumps to underneath 3, and 5 and 6 get pushed down a row, outside of the box.
I'm not sure exactly what's going on, in terms of why the "4" thinks "2" is lower than "3" and so it floats against that-- I assume the screen zoom is putting in rounding errors. This particular case is easily remedied by not changing the margin when hovered and giving the non-hover state a transparent border, rather than assuming a 2px border plus a 2px margin is the same as a 4px margin.
So this case had a simple fix, but the non-intuitiveness and obscurity of the error (in terms of the page zoom) gives me pause. A radical change in structure like that is just not something you would have seen in a table-as-layout solution. Just to get it out of my system, I'd like to write a few more advantages caveman-tables-for-layout have over floating divs. (Which is the fairest way of putting it, I think: people who say the argument is "tables vs css" are being grossly unfair.)
Eric Meyer, in 2009, put it pretty well:
All this is why the old “only use tables for layout” argument keeps coming up over and over: strip away the overheated rhetoric and obvious link-baiting, and you find the core of a real need. Because as powerful as CSS can be, table cells do certain things very easily that CSS makes very, very hard. Cells stretch vertically, keeping equal heights as a matter of their intrinsic nature. They stay out of each others’ way, while still being allowed to sit next to each other and use any sizing dimensions. They tie their layout to their parent elements, and vice versa.I'd love to hear if the situation has changed much since then.
I can see the advantages that floated divs can have: like in today's example I didn't need to pollute the numbered divs with table structure layout, and programmatically it would have easier to just keep on adding in divs, rather than having to coordinate the row structure. (and yeah yeah yeah, tables are for tabular data and using them for layout is the anti-thesis of proper html5 semantic thinking.)
But on the flipside, the wrapper in this example had a fixed height, in part because a container div will collapse if all its contents are floated (hence things like the clearfix hack... and don't get me started about some of the disgusting stuff I've seen to get columns to line up!)
Finally, beside my love of colspans and rowspans and what not, it's a lot easier to throw a "border" onto a misbehaving table you're trying to construct than to get a visualization of errantly interacting floating divs!
I'm swimming against the tide of design history here, I know, but until I learn of a better way to get grid-like behavior on a webpage, tables are going to be part of my web design arsenal.
(Quick followup as I ponder this a bit more: I do realize responsive design is generally a lot harder with tables, because of the mix of form and content. Most of what I really count on tables for, though, is not in the "whole page" style of layout, but for individual smaller widgets, where you really don't want things jumping around, and for them to keep their general relative positions. That's actually one of the paradoxes of responsive design: usually you want layout things to stay the same, no matter how the content changes, but with responsive design you finally want things to shift when the content seems to big for the space allotted...)
Tuesday, May 29, 2012
choking on cookies
Just a note: if you are designing an integration using iframes (like where your content shows up in an iframe on some other domain's site) you need to be aware of some pretty deep browser-specific issues involving cookies. IE will block cookies until some privacy blahblah is set; Safari has similar issues, but it's issue is about cookies on pages that haven't been directly navigated to (i.e. they've only shown up in an iframe, rather than the domain having ever been seen in the URL bar.)
There might be some further differences between the two cases; it seems like IE will allow cookies over the life of the page, at least, which is more than we got from Safari (which was a big issue because our pattern was to authenticate in one endpoint call, and then do further requests for more data) but don't quote me on that. The short of it is: you have to do a lot more QA on cross-brower issues if they involve iframes and other sites, and in fact the problem are so significant you should be thinking about them as you architect your embedded pages (and possibly doing rapid prototypes to make sure you can get to the cookies you need to when you need them.)
There might be some further differences between the two cases; it seems like IE will allow cookies over the life of the page, at least, which is more than we got from Safari (which was a big issue because our pattern was to authenticate in one endpoint call, and then do further requests for more data) but don't quote me on that. The short of it is: you have to do a lot more QA on cross-brower issues if they involve iframes and other sites, and in fact the problem are so significant you should be thinking about them as you architect your embedded pages (and possibly doing rapid prototypes to make sure you can get to the cookies you need to when you need them.)
Wednesday, May 23, 2012
got python? you got a webserver...
At Peter Cooper's How to Build a Chat Room in JavaScript in Under an Hour webinar I learned this trick: if you have python installed on your system (many OSX machines do by default), you have a cheap-and-cheerful, ready-to-go web content server:
Just go to the relevant directory and type:
or whatever port you want, and you can then go to http://localhost:8081/
(Slightly longer explanation at the Linux Journal.)
This can be especially user because some browsers are a bit weird about loading stuff from the file system, you run into odd cross-site-scripting style issues, like if you try to load a static ".json" file or what not.
By the way Peter Cooper also runs Javascript Weekly, a roundup of JavaScript news and articles. Great to finally have found a way to keep up with neat stuff in the industry...
UPDATE:
There's a variant if you want to run scripts:
python -m CGIHTTPServer 8081
It's pretty old-school; you make a cgi-bin directory under where you will run the command. Your scripts then have to start with #!/usr/bin/php or whatever, and have execute permissions.
Also I just realized (duh) that PHP has its own webserver-
php -S localhost:8000
Which avoids some pesky header issues when I was trying to run through Python CGI.
Oddly missing from that previously linked list (tho mentioned in a comment:
npx serve@latest
Just go to the relevant directory and type:
python -m SimpleHTTPServer 8081
or whatever port you want, and you can then go to http://localhost:8081/
(Slightly longer explanation at the Linux Journal.)
This can be especially user because some browsers are a bit weird about loading stuff from the file system, you run into odd cross-site-scripting style issues, like if you try to load a static ".json" file or what not.
By the way Peter Cooper also runs Javascript Weekly, a roundup of JavaScript news and articles. Great to finally have found a way to keep up with neat stuff in the industry...
UPDATE:
There's a variant if you want to run scripts:
python -m CGIHTTPServer 8081
It's pretty old-school; you make a cgi-bin directory under where you will run the command. Your scripts then have to start with #!/usr/bin/php or whatever, and have execute permissions.
Also I just realized (duh) that PHP has its own webserver-
php -S localhost:8000
UPDATE UPDATE
I was running into CORS problems running my own dev server ("Access-Control-Allow-Origin" issues). The python based solutions I googled up looked annoying, but here's another basic webserver you can use, with an argument that runs around the CORS issues:
npx http-server . -p 9999 --cors='*'
(Obviously pick your own port)
UPDATE UPDATE UPDATE
here is a a list of these static servers
UPDATE UPDATE UPDATE UPDATE
Oddly missing from that previously linked list (tho mentioned in a comment:
npx serve@latest
Subscribe to:
Posts (Atom)


