Tagged: ui

Clearing CSS Floats

Here’s a quick tip that will be useful for dealing with content that “overflows” outside of the normal boundaries. Any web designer I’m sure has encountered this issue at some point or another and you may be surprised to find how easy it is to correct. In this example we have an outer div “main content” area in green with a gray div “column” floated to the left with more content than the area will contain given the column’s width. As you can see in the example, the result is that the floated column extends beyond the lower boundaries of the outer div. This is less than ideal, especially when your site’s content is generated dynamically.

CSS Content Overflow

This first solution has stood the test of time and is known as the clearfix method. This technique uses the :after pseudo-element which is supported by CSS2 compatible browsers. Unfortunately, this doesn’t include Internet Explorer 7 and below. You may notice that there is actually two style blocks for our CSS and that is because we are using conditional comments that will target any Internet Explorer browser and use the proprietary hasLayout CSS attribute that must be commented or else your page will not validate.

<style type="text/css">

  .clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
    }

</style><!-- main stylesheet ends, CC with new stylesheet below... -->

<!--&#91;if IE&#93;>
<style type="text/css">
  .clearfix {
    zoom: 1;     /* triggers hasLayout */
    }  /* Only IE can see inside the conditional comment
    and read this CSS rule. Don't ever use a normal HTML
    comment inside the CC or it will close prematurely. */
</style>
<!&#91;endif&#93;-->

View Example #1

Another method uses an additional <div> element on the page with a style of “clear:both” which will force your container to accommodate the cleared element. While just as effective as any of the other methods, there is the concern of adding additional “meaningless” markup to your pages.

<div id="outer">
    ....
    <div style="clear: both;"></div>
</div>

View Example #2

Finally there is a relatively newly discovered technique which is quite easy to implement and is one which doesn’t require additional markup. It simply involves adding a “overflow: auto” property to the outer <div> element.

Half an hour of testing later, I was amazed to find Paul was 100% correct – as this example shows. It seems that reminding the outer <div> that it’s overflow is set to ‘auto’, forces it to think “oh yeah.. I’m wrapping that thing, aren’t I?”.

Alex Walker, sitepoint.com

View Example #3

So there you have it, three different techniques that will help you clear all of those pesky float issues.

More

Upcoming Events for Web Developers


An Event Apart
August 18–19, 2008 San Francisco, CA & October 13–14, 2008 Chicago, IL

Join Eric Meyer, Jeffrey Zeldman and special guests to gain a deeper understanding of web standards and emerging best practices. Be inspired by fresh ideas and new directions. Join the greatest minds and hottest talents in web design today.



The Ajax Experience
September 29 – October 1, 2008 in Boston, MA

The only Web 2.0 development event created by developers, the real experts working in the trenches who have encountered and conquered today’s most pressing pain points. The Ajax Experience is the original and most in-depth rich internet application conference addressing cutting edge topics, from cross-browser compatibility to how to choose the right framework and everything in between. We bring you sessions on performance, scalability, server-side and client-side development, and JavaScript from industry experts who face the same day-to-day challenges as you do. Whether you’re a designer, developer, tester or manager, The Ajax Experience provides you with sessions to take your skills to the next level and enhance your professional development. Guaranteed.



Future of Web Apps
October 8-10, 2008 in London (San Francisco and Miami have also hosted)

The Future of Web Apps showcases the successful web technologies and business trends of the future, delivered by the pioneers of today. Attended by all the major European and US start-ups and industry experts, it’s the best place to learn directly from the developers, designers and entrepreneurs behind the web’s brightest stars in a relaxed and fun environment.



The Future of Web Design
November 3-4, 2008 in New York, NY

Join world-leading web designers in NYC for one day of inspiration, advice and best practice.



(SXSW) South by Southwest Interactive
March 13-17, 2009 in Austin, TX

The SXSW Interactive Festival features five days of exciting panel content and amazing parties. Attracting digital creatives as well as visionary technology entrepreneurs, the event celebrates the best minds and the brightest personalities of emerging technology. Whether you are a hard-core geek, a dedicated content creator, a new media entrepreneur, or just someone who likes being around an extremely creative community, SXSW Interactive is for you!


Mixx 2009
March 18-20, 2009 Las Vagas, NV

MIX is an ongoing conversation between web designers, developers, and business decision makers. We showcase topics and solutions that bridge Microsoft and non-Microsoft perspectives, and emphasize the inclusive and participatory nature of the next web.

More

How To Spot A UI Guru

gu·ru (gŏŏr’ōō, gŏŏ-rōō’)
n. pl. gu·rus

  1. A trusted counselor and adviser; a mentor.
  2. A recognized leader in a field: the guru of high finance.

There is a definitive line between the skill set of a front-end (what you see and do on a web page) and a back-end (what happens behind the scenes.. think e-commerce). Depending on the size of the development team, the same person may or may not fill the shoes of both roles. You can always spot the front-end developers of a company because of their rhino Javascript O’Reilly book and at least one or two CSS books for reference. Additionally these developers will have at least two browsers installed on their machine for testing purposes.

Some gurus prefer to be considered designers, some call themselves developers while in actuality you really should have a little bit of both skills to become efficient at the trade. There is certainly an art to designing a usable yet visually appealing website. Although looks don’t always equal a usable design, we try to make it as nice as possible anyways. Many times the page markup itself will be a work of art in its own right as this sample from css zen garden demonstrates:

<div id="container">
	<div id="intro">
		<div id="pageHeader">
			<h1><span>css Zen Garden</span></h1>
			<h2><span>The Beauty of <acronym title="Cascading Style Sheets">CSS</acronym> Design</span></h2>
		</div>

		<div id="quickSummary">
			<p class="p1"><span>A demonstration of what can be accomplished visually through <acronym title="Cascading Style Sheets">CSS</acronym>-based design. Select any style sheet from the list to load it into this page.</span></p>
			<p class="p2"><span>Download the sample <a href="/zengarden-sample.html" title="This page's source HTML code, not to be modified.">html file</a> and <a href="/zengarden-sample.css" title="This page's sample CSS, the file you may modify.">css file</a></span></p>
		</div>

		<div id="preamble">
			<h3><span>The Road to Enlightenment</span></h3>
			<p class="p1"><span>Littering a dark and dreary road lay the past relics of browser-specific tags, incompatible <acronym title="Document Object Model">DOM</acronym>s, and broken <acronym title="Cascading Style Sheets">CSS</acronym> support.</span></p>
			<p class="p2"><span>Today, we must clear the mind of past practices. Web enlightenment has been achieved thanks to the tireless efforts of folk like the <acronym title="World Wide Web Consortium">W3C</acronym>, <acronym title="Web Standards Project">WaSP</acronym> and the major browser creators.</span></p>
			<p class="p3"><span>The css Zen Garden invites you to relax and meditate on the important lessons of the masters. Begin to see with clarity. Learn to use the (yet to be) time-honored techniques in new and invigorating fashion. Become one with the web.</span></p>
		</div>
	</div>
</div>

If your web page markup at all resembles this then you are well on your way to being a UI guru. Gurus go to extreme lengths to ensure that their sites both function and appear identical to the most users as possible and in today’s Internet is is no small feat. If you think this is an accomplishment, consider the fact that beyond the basic concepts many gurus are self taught. While schools teach the fundamentals of making a functional website they likely won’t get into the facets of designing a quality site that appeals to everyone. Web standards, usability, search optimization are all topics that I myself have had to lean independently of college. What’s so nice about the web platform is that markup is open for any software or technology to develop on, this is most apparent when it comes to the type of application to develop with. While not always the case, these applications are encouraged to abide by the standards put in place by the World Wide Web Consortium (W3C). In time you will learn not to rely on the application to format your markup and be able to write code with just about anything.

For all of those aspiring UI gurus out there, perhaps the best way to learn UI is through trial and error. We learn new concepts and solutions to problems by talking with colleagues and by spiking out through web searches for ways to improve our skills. We also learn by closely following websites authored by industry leaders and finding ways to add our own unique twist to those concepts. Books and websites alone aren’t enough to become proficient, just like anything, the more you practice the better you become.

Recommended books

JavaScript: The Definitive Guide, Fifth Edition
CSS Mastery
Bulletproof Web Design

Recommended Websites

Nettuts.com
A List Apart
Think Vitamin

More