![]() |
Anyone good with HTML + CSS?
Hi!
I'm trying to create a website layout. Right now I've just used different background colors to distinguish the different elements and the positioning of them. Anyhow, the "problem" is: 1. I want margins between the logo and the header, but I can't seem to get any margins cause of the float: left; I've done on the logo. 2. I want the same margin between the left menu(products) and the menu-bar, and also the content. 3. This CSS doesn't seem really good, seeing as if I try to use padding on the header, cause of the h1 element, it get's pushed down really weird. 4. I tried to do the links in the menu-bar like a ul list, and I got rid of the list "dots", but they still were on different rows, how would I solve that? HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">Code:
body {Thanks |
I can't really see what exactly you want to achieve, so here are just some very basic tips for creating (tableless) layouts with CSS.
1. Create your (semantic) HTML 2. Plan your layout (on paper) 3. Add styling so that it works in modern browsers (FF, Safari, perhaps Opera) 4. Look how it works in the various IEs and create extra styling for them (i.e. using conditional comments) But first inform yourself about browser-specific behaviours, especially when you are using floats ("clearing floats") and when you are using paddings ("box model"). There are many more "bugs" or irregularities to name and you'll definitely meet upon several of them. If you aren't planning on really getting into layouting or you're too lazy to be bothered, then start off with one of the many CSS-Grid-Frameworks (Blueprint, YAML, 960, etc.) or grab a template that meets your needs at CSS Zen Garden i.e. Last but not least, put up a demo page and post the link if you want help with a layout. Makes things much easier and less time consuming. Hope this doesn't add to your confusion, because its not meant to do so. |
Thank you!
Those were good tips, and yes, sorry for not uploading a demo website. I planned to do that, but didn't have time. Anyhow, here's some screenshots explaining what I want: http://img13.imageshack.us/img13/5108/margins.jpg http://img13.imageshack.us/img13/4615/linksq.jpg So the first issue, is about the margins, I want margins seperating the parts, but because I used float, it just doesn't work for some reason. The second issue, is not really an issue, but more of a comfortability question. I want the links menu to be a ul list, but if I place it in a ul list, it get's list dots, and on seperate lines. I could remove the dots on the list, but I couldn't get them on the same line. Right now, I just posted HTML Code:
Link 1     Link 2HTML Code:
<ul>Hope this explains more what I'm looking for |
why don't you use Border instead of margin ? And select the matching color.
Quote:
Quote:
You can use list-style:none. And don't forget to download |
The reason the margin wont have any effect is because you have floated it, i.e. pulled it out of the normal flow, thus its on a different level to the header div. In order for it to have an effect you must also float the header.
as for the menu, something like this: Code:
<ul>Code:
ul { |
Quote:
Yes, that's what I've done, but that won't place the list in a single line, the list items will still be on different lines. Thanks for the link! I'll download it :-) Quote:
But if I float the header aswell, the menu's below will appear on the right side of the header, instead of below it? http://img187.imageshack.us/img187/420/margins2.jpg Code:
#header {The list worked like I wanted though, thanks! |
That is also simple.You need to nest it in some [div] tag.
Here is it. I checked it in firefox. Quote:
Quote:
|
Yea, that looks great with the margins!
The only problem with that, is that if I write more content in the "main" div(as a test I just set the height to a larger amount), the #contents div doesn't expand, which could be problematic when you're dealing with dynamic content loaded from a database. Any ideas how to solve the expanding thing? THanks alot! |
Actually, nevermind, I kinda solved it. Here's the finished CSS:
Code:
body {HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">I removed the #contents from the CSS completely, but kept it in the HTML, and then the container got fluid and expanded when the #main div expanded. I also reversed the float, so the "bar" div is floated left, and the links and main divs are positioned relative. |
That looks good.By the way are you trying to code a social Networking site ? If yes then hope to see a Tutorial about that.
|
Great! :-)
No sorry, this is for a clients company/store. But when I get time I could probably code a SN site, shouldn't be that hard. |
Quote:
The one thing about SN is that I have never been able to figure out the code for your friends list. Just like how myspace/facebook does it.... I guess I just never really worked out the algorithm for it...I'm sure everyone knows it but me!! |
I'm not sure, but I would probably just do a table in db like:
friendships fs_id fs_user1 fs_user2 fs_type(like on vB you can have "contact" or "friend") so when fetching someone's friendslist: Code:
"SELECT * FROM `friendships` where `fs_user1` = '".$userid."' OR `fs_user2` = '".$userid."'"; |
Quote:
yeah, do you know how one would show the number of possible friends on the list? what I mean by that is when your friends with someone, you are part of that network, but not necessarily friends with the 1,000's of other people in that network... It's easy to count how many friends you have in your group, but I guess I never really figured out how to count the other possible groups....I think Friendster is the method that I am thinking about most, i don't think facebook does it the same way as friendster... BTW: Has your $3 matrix system worked out yet? |
We're going pretty offtopic right now. But I don't really know how to check that, cause I haven't really thought about it more in-depth. But if I would begin on a project like SN, I could definitly write a tutorial about it(or atleast write some sort of progress-updates).
Haven't heard of friendster, and I don't know what it is.. |
It is good information for how to use HTML and CSS with them combine which is very informative who don't know basic knowledge about HTML and CSS.
php web application development | PHP development | php mysql development | cakephp developers |
| All times are GMT. The time now is 01:33 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0