Did you know? DZone has great portals for Python, Cloud, NoSQL, and HTML5!
HTML5 Zone is brought to you in partnership with:

Chris is married to the love of his life, Danielle. He is a wrangler and writer of developer content for DZone, where he enjoys finding great Python and Windows Phone content. Chris once went a whole week without blinking. He used to be an adventurer like you, but then he took an arrow to the knee. Chris is a DZone employee and has posted 184 posts at DZone. You can read more from them at their website. View Full User Profile

Can "Slopy" CSS3 Make Your Site Look Good?

01.20.2012
Email
Views: 2181
  • submit to reddit
The HTML5 Microzone is presented by DZone and Microsoft to bring you the most interesting and relevant content on emerging web standards.  Experience all that the HTML5 Microzone has to offer on our homepage and check out the cutting edge web development tutorials on Script Junkie, Build My Pinned Site, and the HTML5 DevCenter.
The web is full of sites with clean lines, slick layouts, and smooth features, so much so that Mary Lou at Codrops thinks CSS developers need to have more fun and get a little "slopy".  She has a bunch of fun CSS techniques to prevent your site from looking like all the rest and today I'll show you three of my favorites (though I hope you'll choose something other than hot pink...).

 

Angled Shapes and Diagonal Lines






To create this effect, "even" elements were rotated -5 degrees and "odd" elements were rotated 5 degrees, and a negative top margin was added to get the odd elements in the right position:

.se-slope{
	margin: 0 -50px;
	transform-origin: left center;
}
.se-slope:nth-child(odd){
	background: #000;
	transform: rotate(5deg);
	margin-top: -200px;
	box-shadow: 0px -1px 3px rgba(0,0,0,0.4);
}
.se-slope:nth-child(even){
	background: #e90089;
	transform: rotate(-5deg);
	box-shadow: 0px 2px 3px rgba(0,0,0,0.4) inset;
}



Stacked Menu with Size and Background Mouseover Changes





For this Stacked Menu feature, Mary Lou defined the style for the:

  • list item
  • link element
  • single elements
  • content elements wrapper


Mary Lou created the linear transition for the content elements and then set the font size and color change for the list elements on hover:

.ca-menu li:hover{
    border-color: #fff004;
    background: #000;
}
.ca-menu li:hover .ca-icon{
    color: #fff004;
    text-shadow: 0px 0px 1px #fff004;
    font-size: 50px;
}
.ca-menu li:hover .ca-main{
    color: #fff004;
    font-size: 14px;
}
.ca-menu li:hover .ca-sub{
    color: #fff;
    font-size: 30px;
}

 

CSS3 Lightbox




 
For this CSS3 Lightbox design, Mary Lou used an unordered list with each item containing a thumbnail and an overlay dvision for the larger image.  She made the title for each thumbnail invisible and added an opactiy transition on hover, using a radial gradient as the background:

.lb-album li > a span{
	position: absolute;
	width: 150px;
	height: 150px;
	top: 10px;
	left: 10px;
	text-align: center;
	line-height: 150px;
	color: rgba(27,54,81,0.8);
	text-shadow: 0px 1px 1px rgba(255,255,255,0.6);
	font-size: 24px;
	opacity: 0;
	background:
		radial-gradient(
			center,
			ellipse cover,
			rgba(255,255,255,0.56) 0%,
			rgba(241,210,194,1) 100%
		);
	transition: opacity 0.3s linear;
}
.lb-album li > a:hover span{
	opacity: 1;
}


Be sure to visit Codrops as Mary Lou has a plethora of great ideas for CSS3 design as well as more detail on each of these projects.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

HTML5 is the most dramatic step in the evolution of web standards. It incorporates features such as geolocation, video playback and drag-and-drop. HTML5 allows developers to create rich internet applications without the need for third party APIs and browser plug-ins.  Under the banner of HTML5, modern web standards such as CSS3, SVG, XHR2, WebSockets, IndexedDB, and AppCache are pushing the boundaries for what a browser can achieve using web standards.  This Microzone is supported by Microsoft, and it will delve into the intricacies of using these new web technologies and teach you how to make your websites compatible with all of the modern browsers.