Archive for the 'CSS' Category

Reset your paragraphs and headings

Saturday, March 10th, 2007

Headings, margins and paragraphs behave differently in IE7 and Firefox 2 depending on how you set up your style sheets. You can see this illustrated when you compare the same page in the two different browsers.

The page below has no styling and contains only heading 1, heading 2 and paragraphs tags.

Reset your margins

You can see (above) how the font sizes are pretty much the same, but the spacing above and below the headings and paragraphs differ.

Things become a little clearer (and more bizarre) as you begin to add styling to your page. Below I’ve added font family and size, margin and padding attributes to the body class.

body {font:75% “Trebuchet MS”, Verdana, Arial;padding:0;margin:0;}

Now look at the results below.

Reset your margins

You can see (above) the heading sizes are wildly different and the spacing between all the elements still differ.

Next I’ll reset the margins on all headings (1 and 2 in this case) and specify their font sizes

h1 {margin:0.5em 0 0 0;font-size:200%;}
h2 {margin:0.5em 0 0 0;font-size:150%;}

See the results below

Reset your margins

You can see we’re getting there, but there still seems to be too much margin around the paragraphs in IE. So I’ll reset the margins on all paragraph tags using the following code

p {margin:1em 0;}

See the results below

Reset your margins

Perfect! So if you want your content to look the same in Firefox 2 and IE7 then remember to reset the margins and font-sizes on all your paragraphs and headings. Obviously you don’t have to use the values I specified here, you can make your headings as large or as small as you like!

Finishing Touches

Wednesday, November 22nd, 2006

Have you ever found that no matter how many hours you pour into your site it’s always a few days from completion? As I sit here I can’t help wondering what this page would look like with heading images and differently styles tabs.

Maybe I’ll just keep editing it, after all that’s what the web’s about.

I’ve been in Australia for the past month, so it seemed apt that I use my Sydney harbour photograph as the new header. This image is actually made up of 6 photographs all stitched together. On the right is the Sydney Opera House and to the left, Sydney itself. In the centre of the image is, of course, the Sydney Harbour Bridge.

You’ll notice that when the page is reduced to 800×600 the header image still works, this is because it’s a background within a DIV.

I have many more images which I’m currently submitting to iStockphoto, Dreamstime and Fotolia in order to sell. My favourite photographs turned out to be of my sister’s, wedding. Overlooking palm beach you can hardly go wrong when taking a few snaps. I’ll be posting a few more on this site soon.

Styling lists and my navigation

Wednesday, October 18th, 2006

Who says lists are boring? Well, mine are for the time being, as they’ve only been mildly styled with the help of CSS techniques I’ve learnt over the years. Here are a couple of my favourite list styling tutorials:

The CSSplay page has dozens of real examples – a great list styling tutorial resource.

Navigation? Can’t live without it

Monday, October 2nd, 2006

Most websites need a navigation system, something consistent. Mine certainly does and before today you would have had to scroll to the bottom of the home page to see it. I figured we’d have it above the fold so that visitors on the most common screen resolutions could see it. Placing it to the left also helps as this is where visitors typically look when they want to navigate around a website.

So, how did I do it?

I created a container which holds the content, the navigation and the right hand content and styled with the relative CSS attribute. Then I absolute positioned the navigation and the right hand content within the container and gave the content huge padding on the left and right hand sides so that the content elements don’t overlap.

To get the running background emphasizing the three column layout was a case of adding a very, very thick right and left border to the container. Then it was just a case of negatively re-positioning the navigation and right hand content elements to pull them back over the extra wide container (extra wide because now it has a very very think border).

Here’s the CSS:

#container {
position:relative;
border-left:200px solid #c0c0c0;
border-right:270px solid #ccc;
text-align:justify;
line-height:1.6em;
padding:10px 40px 10px 40px;
min-height:500px;
}
#right {
position:absolute;
top:0;
right:-253px;
width:245px;
padding:20px 0 0 0;
}
#sidebar {
position:absolute;
top:0;
left:-204px;
padding-top:20px;
width:200px;
text-align:left;
line-height:normal;
font-size:90%;
}

Too wide, too narrow?

Friday, September 29th, 2006

As for the 100% width, well that had to go. I’ve opted for the max-width solution (1024) offered by most browsers and a max-width workaround for IE.

I also wanted a min-width so I hacked Sven’s solution and made it work in reverse. Added a couple of DIVs around my page and hey presto I’ve got a max, mix-width solution

Here’s the CSS:

#max {
margin:auto;
max-width:980px;
width:expression(document.body.clientWidth greaterThanSign 980? “980px”: “auto” );
}
#min {
min-width:770px;
width:expression(document.body.clientWidth lessThanSign 770? “760px”: “auto” );
}

Sorry about the greaterThanSign etc. in the code. Wordpress doesn’t seem to convert the HTML into the corrent character and the page is failing the accessibility check.

Who likes Times?

Friday, September 29th, 2006

Not me. I’m going for Trebuchet. Besides, it looks sexier on the screen. Also, how about those massive links within heading, let’s get rid of the underline – I think it’s clear they’re linked to the relevant story.

A new name, a new wesbite

Wednesday, September 27th, 2006

Pixel Juice will now be called Digitally Refreshing. The pixeljuice.co.za domain will still be alive for a while yet and will point to this website - but I felt it was time for a brand evolution.

Digitally Refreshing far better describes what we do here, which is building digitally refreshing websites!

Now comes the hard bit - the big redesign! I’ve decided to proceed in a way that I’ve never tried before. Why begin with an image typically created in Photoshop, why not just jump straight into the CSS and design from the code up?

Check back for my daily progress. And along the way I’ll make sure to share all the CSS secrets and unwritten rules I find…

More from Pixel Juice: Aloe Nursery

Friday, April 14th, 2006

Aloe NurseryAloe Nursery needed a one page, quick win result. We were able to quickly understand customer requirements, design and implement a one page site for Aloe Nursery.

“The site will grow in time, but for now I just need a simple, effective and attractive presence” – Owner.

We feel we have met the objectives laid out by Aloe Nursery. Take a look for yourself, and while you’re over there order some aloes for your garden!

Cameron McIntosh Wins Again

Friday, April 14th, 2006

Cameron McIntoshA nail-biting encounter took place on the Ash River outside Bethlehem this weekend when current SA Champion, Cameron McIntosh, narrowly kept off an impressive surge by junior Michael Watson to win a historic 7th national title

Read more about Cameron and his development teams on his website, CameronMcIntosh.com.

Cameron approached Pixel Juice for a website solution which would allow him to regularly update his own website without having to pay costly updating fees. We used a Wordpress solution and custom built a look and feel template which is easily updatable. When Cameron reaches the Olympics, we’ll be able to update the look and feel of his website in order to reflect this achievement.

Thermitec

Thursday, February 9th, 2006

All Photography: Pixel JuiceAnother website from Pixel Juice. Thermitec, specialising in engineering solutions approached Pixel Juice with simple requirements. They needed a no nonsense approach to web design. In the words of Thermitec ‘we need a site that tells people what we do and what we offer, clearly and succinctly’.

Visit Thermitec now for all your engineering requirements. All on-site photography supplied by Pixel Juice.


Close
E-mail It
Socialized through Gregarious 39