CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 8th, 2012, 08:42 AM
nivlat nivlat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 4 nivlat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 38 sec
Reputation Power: 0
Css problen with layout

Hi every one, I have this problem with layout:

the navigtion block is perfectly aligned under the header (at 113px from top);
but the content (whatever I try - even specifying 113px from top) do not: there is always a space about 10px between header and content.
Please help!
thanks in advance,
nivlat

html
-------------------------------------

Code:
<head>
<title>the trashcan</title>
<link rel="stylesheet" type="text/css" href="main2colonne.css"/>
</head>
<body>
	<div id="container">
		<div id="header"><img src="logo.png"/><img src="trashcan.jpeg" width="113" height="113"/></div>
		<div id="content"><p>lotext text text text text text tee text text text text teext text text text txt text text text text texxt text ext text text totext text text text text text tee text text text text teext text text text txt text text texotext text text text text text tee text text text text teext text text text txt text text otext text text text text text tee text text text text teext text text text txt textotext text text text text text tee text text text text teext text text text txt text text text text texxt text ext text text text text texet text text text texxt text ext text text text text texettext text texxt text ext text text text text texett text texxt text ext text text text text texetext text texete </p></div>
		<div id="navigation"><p>first link</p></div>
		<div id="footer"><p>copyright bla bla bla bla bla</p></div>
	</div>
</body>
</html>


css
-------------------------------------------

Code:
body, html{
	margin: 0;
	padding: 0;
}
div#container{
	position: relative;
	width:80%;
	background-color: green;
	margin: auto;

}
div#header{
	margin-bottom: 0;
	height: auto;
}
div#content{
	background-color: blue;
	color: red;
	width: 80%;
	top: 113px;
}
div#navigation{
	position: absolute;
	right: 0;
	top: 113px;
	width: 20%;
	background-color: grey
}
div#footer{
	background-color: pink
}

Reply With Quote
  #2  
Old September 8th, 2012, 09:19 AM
AndrewSW's Avatar
AndrewSW AndrewSW is online now
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 4 m 50 sec
Reputation Power: 164
This is caused by the first paragraphs' top margin:

Code:
div#content p {
    margin-top: 0px;
}


Note that this will remove the top margin from all paragraphs in the content div, so a better solution should be considered.

Added: I would recommend that you generally avoid absolute positioning - prefer floats. Absolute-positioning is only suitable in certain situations.

Last edited by AndrewSW : September 8th, 2012 at 09:21 AM.

Reply With Quote
  #3  
Old September 8th, 2012, 09:58 AM
nivlat nivlat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 4 nivlat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 38 sec
Reputation Power: 0
thank you very much for help, I will try that and consider other solution

Reply With Quote
  #4  
Old September 8th, 2012, 10:08 AM
nivlat nivlat is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 4 nivlat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 22 m 38 sec
Reputation Power: 0
Tried out, now the gap is only about one-third than before, but there is still some.
I'm new to web design so I'm not sure of what I'm about to say: could it be a browser-related problem (I use firefox)?

any other ideas?

Thank you,
nivlat

Reply With Quote
  #5  
Old September 8th, 2012, 10:32 AM
AndrewSW's Avatar
AndrewSW AndrewSW is online now
JavaScript is not spelt java
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2011
Location: Landan, England
Posts: 743 AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level)AndrewSW User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 23 h 4 m 50 sec
Reputation Power: 164
Test it in different browsers. If you have the same issue then it is not browser-related.

I don't see a gap between the header and content in Firefox.

Reply With Quote
  #6  
Old September 11th, 2012, 04:45 AM
aren aren is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 3 aren User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 57 m 38 sec
Reputation Power: 0
I got such a nice information.Thanks for sharing.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Css problen with layout

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap