[Problem] Turning my layout into a website

Hello,

I have designed a layout for my website in my graphics software, and I was quite satisfied. So I decided to start turning it into html and css, and make the navigation bar and links work. Because image slicing and exporting turns your layout into a big html table with spacers, and I wanted to design my layout using divisions and css, I just manually sliced the image and exported the images. Turning these into a fluent layout, I ran into some problems. I can’t figure out how to position all the elements correctly.

The layout should look like this:

index.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Wouter's Gedichtenpagina</title>
<link href="layout.css" rel="stylesheet" type="text/css" />
</head>

<body>
	<div id="header">
    header
    	<div id="links_nav">
        </div>
    	<div id="navbar">
        	<table border="0px" cellpadding="0px" cellspacing="0">
            	<tr>
                	<td>
                    <img src="images/navbar_normal_03.gif" height="76px"/>
                    </td>
                 	<td>
           			<img src="images/navbar_normal_04.gif" height="76px"/>
                    </td>
                    <td>
          			<img src="images/navbar_normal_05.gif" height="76px"/>
                    </td>
                    <td>
            		<img src="images/navbar_normal_06.gif" height="76px"/>
                    </td>
                    <td>
            		<img src="images/navbar_normal_07.gif" height="76px"/>
                    </td>
                    <td>
           		 	<img src="images/navbar_normal_08.gif" height="76px"/>
                    </td>
                  </tr>
            </table>
        </div>
    </div>
    <div id="image">
    image
    </div>
    <div id="content">
    content
    	<div id="featured1">
        featured 1
        	<table border="0" cellpadding="0" cellspacing="0">
           		 <tr colspan="3">
                 	<td>
                    <img src="images/Gedichten_layout_13.jpg" />
                    </td>
           	 	</tr>
                <tr>
                	<td>
                    <img src="images/Gedichten_layout_16.jpg" />
                    </td>
                    <td>
                    <img src="images/Gedichten_layout_19.jpg" />
                    </td>
                    <td>
                    <img src="images/Gedichten_layout_18.jpg" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="featured2">
        featured 2
        </div>
        <div id="featured3">
        featured 3
        </div>
        <div id="featured4">
        featured 4
        </div>
    </div>
    <div id="footer">
    footer
    </div>
</body>
</html>

layout.css:

@charset "UTF-8";
.body {
	padding: 0px;
}
#header {
	position:absolute;
	left: 0px;
	top: 0px;
	background-image:url(images/Gedichten_layout_01.jpg);
	width: 1200px;
	height: 69px;
}
#links_nav {
	position: absolute;
	left: 0px;
	top: 69px;
	width: 352px;
	height: 76px;
	background-image:url(images/Gedichten_layout_02.jpg)
}
#navbar {
	position:absolute;
	left: 352px;
	top: 69px;
	height: 76px;

}
#image {
	background-image:url(images/Gedichten_layout_10.jpg);
	position:absolute;
	top: 145px;
	left: 0px;
	height: 413px;
	width: 1200px;
}
#content {
	position: relative;
	top: 558px;
	background-color:#f7f0f0;
	width: 1200px;
	height: auto;
	
}
#featured1 {
	clear: both;
	width: 382px;
	height: 400px;
	position: absolute;
	top: 558px;
}
#featured2 {
	width: 382px;
	height: 400px;
}
#featured3 {
	width: 382px;
	height: 400px;
}
#featured4 {
	width: 382px;
	height: 400px;
}
#footer {
	clear:left;
	width: 1200px;
	height: 223px;
	background-image:url(images/Gedichten_layout_26.jpg);
}

For some reason, no matter how I change the properties of the “content” division, it keeps being positioned the way it is. Making its position: absolute and top: xxx px does not change its position.
I’m also aware that this might be a wrong way to design a layout, using absolute positioning. I would do it with floating if I could, but that didn’t work either.
Just let me know if I you need additional information to solve this.

Thanks in advance, Wouter

The reason I’m creating a table within a division, is for the navigation bar. I want the links to turn white and change font when hovered, but the small arrow on the black bar below should also point to the link that is hovered or currently active. I was not sure how to code this properly, so I decided to slice every link with it’s part of the black bar into a separate image, and create a rollover state with the black little arrow active and the text in white. That way I can make the navigation bar and setup hover states.

(This is extracted from my WYSIWYG-editor)

The following happens with the current code:

and:

Start with uploading your site somewhere and giving us a link.

It will be easier, faster and that’s the only way I’ll even try to help you, because at this moment figuring out what’s going on is a bit confusing (especially when I see so many tables in your code, while the layout doesn’t seem to contain any table data at all).

BTW I’m sorry, don’t want to insult or something, but the design is poor in my opinion Especially the background, menu arrow and shadows. And read something about “the rule of third”, in this (like in most) case 50/50 composition is not looking too good.

Cheers.

Fixed height areas, fixed width, fixed image interactions…

… and people wonder why I say drawing a pretty picture in photoshop has nothing to do with web design. My advice? Throw it out, markup up your content semantically, design the layout using CSS, and THEN start up the goofy paint program to make the graphics to hang on the layout.

I don’t even consider your picture viable for the web so far as design elements go.

Thanks for the many replies. I just registered with a free hosting service, so it will take up to 24 hours before I can put my website online. I will then share the link here.

I would design a layout in html/css and then insert images after I made several working divisions, but I just thought it would be easier to first decide from the image which divisions I’ll need, and then code them. I am familiar with these 3 column + footer + header and similar css layouts, but that won’t be enough for this design.

For the table I used to make the featured article box, I’m not sure how to group the elements together without using a table. It contains one button, several images around it, and the actual text which will be extracted from the database using php/mySql. One thing I didn’t take into account, is the font size viewers use. When they make it bigger than normal, the fixed boxes wouldn’t stretch along with the text, unless I use ‘em’ instead of pixels.

I find this a very useful colour scheme designer.

Wout: this means http://www.webrichtlijnen.nl/
I don’t agree with everything in there, but in general it points you in the right direction regarding web accessibility (which is even important for a personal site at some level). I assume they will be updated since WCAG2 has been taken up last summer to be translated to new webrichtlijnen by Ralph de Rooij and others.
add’l reading: http://www.drempelvrij.nl/waarmerk

Also, a small change on Crusty’s code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	[b]lang="nl"
	xml:lang="nl"[/b]
><head>

I’m always disappointed and surprised at the number of Dutch web sites that state they are written in English using those attributes— mostly by sites built on CMSes that were originally written in Engrish. I’ve seen English messages regarding skip links, noscript tags saying “please turn on Javascript” and noframe text saying (again, in English) “Your browser doesn’t support frames”. Arg. With hand-written sites you won’t have this problem.

I don’t even bother with XHTML if I’m not redoing an XHTML site.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html lang="nl">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="content-language" content="nl">
    <title>teh titel</title>
    <meta name="description" content="beschrijving van de pagina... dit is per pagina! niet per site!">
    <link rel="stylesheet" ...enz >
  </head>

But whichever you choose is usually a matter of personal preference. Dreambeaver likes to use XHTML Transitional for some reason. Every time someone argues “but XHTML is the future”, their argument is lost when they use Transitional instead of Strict. Lawlz.

I should have elaborated further.

Because of the random dots and flare in the top area it would be difficult to make that pink header a tiled image. This would likely result in a image in excess of 300k all by itself, double the upper limit would ever use for an entire PAGE on a site (images+markup+CSS+scripting)

The large sky banner would also be absurdly large, and it’s height pushes anything resembling actual CONTENT (the stuff people actually visit websites for) clear past the fold even at 1024x768, meaning a lot of users are likely to bounce. I would take an axe to that immediately. It would also be tricky to do without resorting to alpha transparency, and for me if a layout requires alpha transparency I don’t consider it a viable design.

The four sub-areas below that if you want them equal height you are left either using a table (fail), breaking up the content so you can faux-columns it (fail, fail), or have to fix the height of the containers, the size of the content and end up having to micro-manage the content making any changes in the future a royal PITA. (fail, fail, failfailfail). This you seem to have realized yourself in your latest post. It MIGHT be possible to use faux-columns and a trick similar to how 100% min-height layouts work to pull it off, but no guarantees on that.

The grey text on the light blue background is effectively illegible for about half the population, the white on grey in the areas below that much worse so. You may want to read the two versions of the Web Content Accessibility Guidelines (WCAG) for information on color contrasts, though I simplify it down to 50% luminance minimum, 75% lumanance ideal.

The gradient behind the quote box makes creating that as a dynamic height element difficult at best. The image would/should likely be re-adjusted or sliced in a manner to allow dynamic height so you can have quotes that go to more than one line.

… and the whole thing isn’t even designed 1024 friendly (aka 976px wide ideal) meaning netbook and pad users are out in the cold.

In any case, even when working from a PSD the first thing I do is strip out the content for ‘what it is’ pretending that the layout and graphics don’t even exist. That means a h1, a ul, a IMG for the banner, four DIV with h2/div/p/a/div nesting for those subsections, a blockquote/p/cite, and #footer with a UL in it.

In terms of formatting div given the layout, I’d probably put a sandbag before the width wrapper for the top area full width background, which would allow the bottom background to be on body. (best way to handle it), that way you only need one width constraint. I’d also toss extra div for faux-columns around each ‘row’ of those center boxes in the content area since MAYBE if the footer is always the same size you could use a full-height/absolute positioning trick to pull it off (though again, the styling on those may have to simply be thrown away)

That would give us something like this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	lang="en"
	xml:lang="en"
><head>

<meta
	http-equiv="Content-Type"
	content="text/html; charset=utf-8"
/>

<meta
	http-equiv="Content-Language"
	content="en"
/>

<link
	type="text/css"
	rel="stylesheet"
	href="screen.css"
	media="screen,projection,tv"
/>

<title>
	Template Design CSS
</title>

</head><body>

<div id="topBackground"></div>

<div id="pageWrapper">

	<h1>
		Wouter's
		<span>Gedichtenpagnia<span></span></span>
	</h1>

	<ul id="mainMenu">
		<li><a href="\\">Home</a></li>
		<li><a href="gedichten">Gedichten</a></li>
		<li><a href="teksjes">Tekstjes</a></li>
		<li><a href="fotos">Foto's</a></li>
		<li><a href="overMij">Over Mij</a></li>
	</ul>

	<img
		src="images/banner.jpg"
		alt="Describe this image"
		class="banner"
	/>

	<div class="subBoxFauxColumns">

		<div class="subBox">
			<h2>Gedicht</h2>
			<p>
				Morbi sed nibh non tellus sodales interdum. Nulla dignissim pulvinar est, ac aliquam eros pharetra at. Sed Suscipit libero eu ante porta accumsan. Velit ipsum vulputate nunc.
			</p>
			<div class="subBoxFooter">
				<a href="gedichten" class="more">Lees Meer &raquo;</a>
				<div class="replies">2 reacties</div>
			<!-- .subBoxFooter --></div>
		<!-- .subBox --></div>

		<div class="subBox even">
			<h2>Tekstje</h2>
			<p>
				Nunc accumsan vestibulum mollis. Vivamus consectetur iaculis ipsum, ut iaculis mi varius at. Sed vulputate ligula eu massa pellentesque a sceler-isque diam pharetra. Aliquam erat voluptat. Cras venatis neque et sem.
			</p>
			<div class="subBoxFooter">
				<a href="tekstje" class="more">Lees Meer &raquo;</a>
				<div class="replies">0 reacties</div>
			<!-- .subBoxFooter --></div>
		<!-- .subBox --></div>

	<!-- .subBoxFauxColumns --></div>

	<div class="subBoxFauxColumns">

		<div class="subBox">
			<h2>Foto</h2>
			<img
				src="images/dummyPhoto.png"
				alt="some photograph"
				class="plate"
			/>
			<div class="subBoxFooter">
				<a href="fotos" class="more">Lees Meer &raquo;</a>
				<div class="replies">0 reacties</div>
			<!-- .subBoxFooter --></div>
		<!-- .subBox --></div>

		<div class="subBox">
			<h2>Romantische tip</h2>
			<img
				src="images/pad.png"
				alt="notepad"
				class="leadingPlate"
			/>
			<p>
				curibitur eget neque eget urna facilisis blandit. Donec mattis metus ac placerate feugiat massa felis sember leo a egestas dolor augue sit amet augue.
			</p>
			<div class="subBoxFooter">
				<a href="fotos" class="more">Lees Meer &raquo;</a>
				<div class="romantische">0 reacties</div>
			<!-- .subBoxFooter --></div>
		<!-- .subBox --></div>

	<!-- .subBoxFauxColumns --></div>

	<blockquote>
		<p>
			Imagination is more valuable than knowledge
		</p><p>
			<cite>- Albert Einstein</cite>
		</p>
	</blockquote>

<!-- #pageWrapper --></div>

<div id="footer"><hr />
	Ontwerp en codering door Wouter Bruyninckx
	<ul>
		<li><a href="\\">Home</a></li>
		<li><a href="teksjes">Tekstjes</a></li>
		<li><a href="fotos">Foto's</a></li>
		<li><a href="gedichten">Gedichten</a></li>
		<li><a href="romantische">Romantische Tips</a></li>
		<li><a href="quotes">Quotes</a></li>
		<li><a href="overMij">Over Mij</a></li>
	</ul>
<!-- #footer --></div>

</body></html>

No guarantees on when as I’ve got actual work to do today - but I might take a stab at the CSS and remastered images to go with that. Proabably throw away some of the elements as ‘non-viable’ in the process, but we’ll have to see.

A link to a live site would definitely be helpful. Matt, you’re right, but as Poes pointed out, we all had to go through the initial stages of designing sites that either looked like pluperfect hell or were more than we could manage. Wouter’s is not a bad design concept for the first time out of the gate.

The problem with “design in Photoshop, then slice and code” is that Photoshop is not a Web design program. By necessity, you’re forcing coded structure onto what is, in essence, a pretty picture. Unless you’re very good at it, you’re going to most likely create a tangled mess of code that only roughly approximates your picture.

There are some quite accomplished Web designers who do it the way you’ve outlined. It is a valid way to design a site. It’s been my experience that SitePoint’s design forums are populated, mostly, by “standardistas” who believe in code before graphics – i.e. doing as DS suggests and beginning with an HTML/CSS structure, then designing images in Photoshop to decorate the structure as you’ve created it. I prefer to do it the second way, in large part because I never learned to do it the first way (I learned much of what design skills I do possess right in these forums), and because I think it’s the “right” way to create Web sites.

And there’s nothing “normal” or “abnormal” about fixed widths. Fixed-width is one way among several to structure Web sites. You might do some reading on “liquid” and “elastic” layouts.

The most important thing is for you not to give up. You’ve created a design for a site in Photoshop. We’re glad to help you translate it into a real site using HTML, CSS, and yes, PS. Keep plugging, and keep asking questions.

Is it possible to code the structure to give something like this:
http://img412.imageshack.us/img412/1528/gedichtenlayoutedited.jpg ?
The navigation has to be positioned absolute, and above the header div then. I could set a fixed width for the actual site and make the header and footer stretch horizontally using those small 1px images.
The container for the content could make sure all content stays centered and in a fixed width small enough to be viewed by smaller resolutions (nevermind the 100% width).

I’m still waiting for the webspace to be approved.

That’s what I meant in addition to giving you an idea of what it will look like.

Obviously a Photoshop image file won’t stretch beyong it’s actual width if you make the window you are viewing it in larger than the image width.

If the header were held above the menu and the menu allowed to center, then the actual page width wouldn’t be giving my browser a scrollbar even when set to 1280px. Looks to be about 830px in width.

Your first webpage is always going to suck— everyone’s does, especially when using a WYSIWYG editor (they’re, um, too “helpful”). Keep following Stevie’s advice, and if you did everything right, two years from now you’ll look at that code and puke (this is a good thing, it means you spent two years learning how to code).

Nothing on that page asks for a table, so now you know you shouldn’t be using any at all.

@ Stevie D: I will switch the table for an ul for the navigation. The problem is I haven’t uploaded the website anywhere, I don’t have any web space avaiable right now. I know it’s confusing for the reader, as no one can see what my image slices represent.

@ deathshadow60:

I don’t even consider your picture viable for the web so far as design elements go.

I don’t see what’s wrong with the website design? The width is fixed yes, and the banner has a set height, but that’s normal right? I have seen several videos on the topic and read some guides about the process from scratch to a working website, and all of them followed the same routine of first putting the idea and goal with the website hierarchy on paper, then designing the layout in graphics software, and finally slicing and coding it.

@ Stomme poes: I got inspired by another design tutorial using a similar structure for the header/image and menu. I assumed my website viewers use a resolution of at least 768x1024 here.

I know it all isn’t perfect, but this is the first time I make a website from a design. With using my WYSIWYG editor, I mean splitting up the view, and only writing the code myself. I don’t touch the graphical part, that’s just to see whether I’m working right or not. I could have just used programmer’s notepad or HTML kit for the coding. Does this design really fail that bad? I was actually quite proud of it myself for a first design :(.

You’re better off using a <ul> list, and setting the basic background image on the ul li {…}, then you can add a rollover effect with an extra background image on ul li a:hover {…}. After all, it is a list of options, so <ul> is the most appropriate element to use. Depending on the setup, you can either float the list items or use display:inline; to get them to run horizontally rather than vertically. See Listamatic for a whole host of design styles for navigation lists.

In terms of what’s happening with the content, posting screenshots isn’t really enough - I need to see an actual page where you’ve got the problem so that I can look at how it’s all fitting together, and to play around with different options.

Sorry, what is happening when you try the CSS layout?

Absolute positioning is generally a bad idea if you can avoid it, as it tends to go wrong when people have a different setup to you, eg smaller window size, different fonts.

I’m not sure why you’re still using layout tables within a CSS layout either!

I don’t see anything wrong with it as the outcome of a page - if you can build the HTML and CSS that will give that end result (subject to the browser being capable of doing so), that’s fine. But you can’t get there from here. Starting with the visual design that you have shown us, it’s very difficult to track back into code that gives a functional, accessible page that looks like that. But if you start with the basic page structure, it’s much easier to build it up to something that looks more or less like the pretty picture you started with.

Design, slice and code is one way of doing it, but as Max says, it’s not one that generally gives good results, particularly for less experienced designers. The problem is that a Photoshop graphic is fixed, you know exactly where every pixel is and how it behaves, because you’ve nailed it to the canvas. A web page isn’t like that. It’s made up of different components (elements), and you have to assemble them so that they fit together and interact with each other in the right way … bearing in mind that different browsers, different operating systems, different user-defined settings and different screen/window sizes can all affect the output.

I assumed my website viewers use a resolution of at least 768x1024 here.

Ooh, bad assumption. Sure, most people might have a screen size of 1024×768, but that doesn’t mean they have that much space available for your web page. There’s still a significant minority of people using 800×600, and there’s a growing number of people using much smaller screens than that - ie, mobile phones, PDAs etc. Even where people are using the screen size you assume, that isn’t the end of the story. I know plenty of people who browse with a sidebar open all the time, which eats into that space. On my home PC, I have a resolution of 1280×1024, but unless I’m looking at something large and graphical that needs the space, I don’t have my browser tabs maximised, because it just gets too big to comfortably read - I don’t know exactly what tab size I’ve got but it’s less than 1000px wide.

I know it all isn’t perfect, but this is the first time I make a website from a design. With using my WYSIWYG editor, I mean splitting up the view, and only writing the code myself. I don’t touch the graphical part, that’s just to see whether I’m working right or not. I could have just used programmer’s notepad or HTML kit for the coding. Does this design really fail that bad? I was actually quite proud of it myself for a first design :(.

Don’t worry too much about DeathShadow criticising your design. I think the highest praise I’ve heard from him is “That’s not too bad … for a beginner”, and that was only once :eek: But despite his, ahem, somewhat caustic approach, he does talk a lot of sense. In terms of what you want the end design to look like, I don’t think it’s bad at all - although possibly a little too heavy on large graphics and shadow effects, the graphics will add a lot of bytes to the download, and the shadow effects might cause you headaches coding them - but it doesn’t look bad. It’s just very difficult to go from there to a good web page.

I don’t see any problems in using Photoshop to design a web page layout so you can see what the end product will look like.

Except a static canvas is completely different than the variety of screens that display web sites in browsers… it could be good for showing you (or a client) how different colours work together with text and that sort of thing, I suppose.

I don’t see any problems in using Photoshop to design a web page layout so you can see what the end product will look like.

In your design in post no. 1, I don’t see anything that requires tables for layout. You can do it all with semantically correct html elements.

Using the KISS principle as much as possible, I would suggest coding up the html (before slicing any images from your PS design) and make sure the layout is correct structurally by validating your code on the w3c validator.

I suggest you use <ul> for the menu and appropriate container elements for the content in the other boxes. At this stage you could insert the actual or temporary text in the various containers.

After the html structure and menu functionality is set up and validated, then you can slice up your design image and add the appropriate images where they need to go.

Bottom line: build the skeleton (html and functionality) first and then add the flesh (shiny images etc) to the bones - my :twocents: