Posts Tagged ‘css’

Generating double borders with CSS04
May

I was working on a site the other day which had double borders around images. This is nothing new and is easily achievable with no extra markup and a bit of basic CSS. The problems arose when I wanted to achieve the same effect using a div.

Let’s start with the image example…

img {
background:#222;
padding:3px;
border:3px solid #666;
}

This gives us the following effect…

Baby red howler monkey which I photographed on the Tambopata river in Peru.

I then wanted to achieve the same effect with a div. The most obvious option was to use two divs and put one border on each div.


#innerDiv{
background:#fff;
border:3px solid #222;
padding:8px;
}
#outerDiv{
border:3px solid #666;
}

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Morbi ultrices dignissim neque. Suspendisse potenti.

Although this worked I was not keen on using an extra div purely for presentational purposes and decided to work on a more css-based solution. I refreshed my knowledge of the CSS border property and then came up with the idea of combining border-style:ridge and border-style:groove to make a two-tone double border.


#myDiv1{
background:#fff;
padding:8px;
border-top:6px ridge #444;
border-right:6px groove #444;
border-bottom:6px groove #444;
border-left:6px ridge #444;
}

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Morbi ultrices dignissim neque. Suspendisse potenti.

This approach enabled me to get a double border only using one div but it still had it’s limitations. The groove and ridge border styles spilt the border in half so for this example 3px and 3px it worked fine. However if I had wanted to make one border thicker than the other this would not have been possible. Also you only get to define a starting colour for the border, in this example #444. The browser then uses this to generate a lighter (#c6c6c6) and darker (#262626) border. Not being able to specify border colours and border widths meant that this solution was not feasible.

Finally I tried using the css outline property. CSS outlines are similar to borders but they do not take up any room on the page. This means that they overlap other elements that are next to them in the page. To counter act this it is therefore also necessary to add some margin to our div.


#myDiv2{
background:#fff;
padding:8px;
border:3px solid #222;
outline:3px solid #666;
margin:3px;
}

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Morbi ultrices dignissim neque. Suspendisse potenti.

This solution enables us to control the thicknesses and colours of each border independently and does not require any extra html markup. This was the option that I went with.

EDIT 28/05/09: Unfortunately (but not suprisingly) this last option does not work in Internet Explorer due to lack of support for the CSS outline property. Back to the drawing board.

Halo Public Relations16
Mar

Yell.com Vista gadget15
Mar

The Yell.com Vista gadget project was a follow on from the Yell.com google gadget project. Unsuprisingly the functionality and design of the main body of the vista gadget is very similar to it’s google counterpart.

The default view (docked view) of the gadget is simply a Yell.com logo. This decision was made to minimise the amount of space the gadget took up on the sidebar. Clicking the docked gadget displays a secondary screen (AKA flyout) with a three box business search form. Clicking the map tab opens up a new form enabling the user to search for a map of their entered location.

Yell.com Vista gadget screenshot

In addition to the docked state and the two flyout views there is a user preferences tool panel for the gadget. This allows the user to customise the gadget to suit their personal needs.

  • A default location can be entered (perhaps the user’s home town) to pre-populate the search flyout.
  • The default flyout can be changed from the business search to the maps search.
  • The gadgets tooltips can be hidden, this is a feature which displays on the maps tab and alerts users to options available in the tool panel.

Vista gadget user preferences tool panel

The gadget is largely built using html, css and javascript but it also makes use of the Vista gadget API to display background images, trigger flyout animations and to set/get user preferences. Once completed the gadget project folder is zipped up, renamed from .zip to .gadget and uploaded to the Windows Live gallery where it can be downloaded, rated and reviewed by anyone running Windows Vista.

So far the Yell.com Vista gadget has been downloaded 1684 times and has generated over 6,000 searches in the last 12 months. If you are a Windows Vista user you can get the gadget for free from the Windows Live gallery.

The Wheelhouse at Noss09
Mar

Of all the websites that I have created this remains one of my favourites. It was a refreshing project because for once I had all the content for the site before I actually started designing, a rare luxury in this industry. The main idea behind the site was that all the content would be written on the back of a seaside postcard. I thought that this would give the site a relaxed feeling and provoke site users to make a positive association between the site and their previous holidays.

A screenshot of www.thewheelhouseatnoss.co.uk

The illustrations for the site where created using Fireworks CS3 on the mac. To create the gradient colour scheme for the background I used a colour picker to carefully select swatches from a photo of an idyllic desert island beach which i found on flickr. The swirly font used for the site is Giddyup Std and it is implemented using a combination of background images and sifr.

The handwriting style font along, the crimped, stamp-like edges for photos and the homemade Noss Mayo postmark all help to reinforce the postcard themes that I wanted to get across. These same themes where also used to create some double sided postcard layouts for The Wheelhouse to use as oversized business cards/flyers (see below).

Double-sided postcode print layouts created for The Wheelhouse

Following it’s release the website was featured on numerous CSS galleries and was later included in Vandelay Design’s
25+ Inspiring Designs by Land, Sea & Air blog article and psd.tuts+ Inspiration: Water and Ice blog. It is always nice to find out that your work is appreciated.

Yell.com google gadget07
Mar

Working on the Yell.com google gadget was an enjoyable experience. I knew very little about the google gadget API before I started and this made the process all the more rewarding.

Read the rest of this entry »