This week we'll go over multiple column layouts that can be implemented via CSS using floats. We will also cover CSS rollovers/hover state with image sprites.
Company Name 1 - Step #4: Columns
A three column layout would look something like the following:
html
<div class="row">
<div class="column">
First column
</div>
<div class="column">
Second column
</div>
<div class="column">
Thrid column
</div>
</div>
css
.column {
width: 30%; /* set column width */
float: left; /* float left or right */
margin: 0 1.5%; /* set left & right gutter */
}
The row class has a clearfix which will clear the floats & bring back it's children elements to normal flow. Each column is floated left, making them line up horizontally. They also have a width of 30% & margin left & right of 1.5%. One column has a total width of 33%.
There are 3 columns, 33% * 3 = 99%
which will fill up the whole row.
A grid system is a structure that allows for content to be stacked both vertically and horizontally in a consistent and easily manageable fashion. Additionally, grid system code is project-agnostic giving it a high degree of portability so that it may be adopted on new projects.
An image sprite is a collection of images put into a single image. A web page with many images can take a long time to load and generates multiple server requests. Using image sprites will reduce the number of server requests, save bandwidth, & help with performance.
-
Select the
Big Button
with the marquee tool. -
Turn off
mid
&bg
layers. We want the background to be transparent. -
Copy Merge (
CMD + SHIFT + C
). -
Create a New document (
CMD + N
). Dimension 237x59. -
Paste the image (
CMD + V
). -
Go back to
CompanyName1_Design.psd
. -
Enable button rollover/hover state which is the
Shape 3
Layer withinHOME PAGE > section1 > intro type bl... > button
. -
Copy Merge
Big Button
again, this time with it's rollover/hover state. -
Go back to the document you've created earlier with
Big Button
. -
Change Canvas Size (
CMD + OPT + C
). Double the height & set top anchor. Dimension 237x118. -
Paste the hover state image (
CMD + V
) & nudge it down to fit the space we've just created. -
Disable the
Background
layer. -
Now we can Save For the Web (
CMD + OPT + SHIFT + S
). Export asPNG-24
.
- Continue to Step 4 & 5 of coding Company Name 1. Be sure to work in a new (separate) folder, such as "companyname1-step4" & "companyname1-step5".