Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
CSS - Absolute Positioning within Masthead
Old 07-27-2009, 05:20 AM CSS - Absolute Positioning within Masthead
jj1
Extreme Talker

Posts: 150
Trades: 0
I'm trying to replace my table-based design with CSS positioning but things are not going well.

In my masthead I want to use absolute positioning to position different images and menu options ABSOLUTELY within the MASTHEAD rather than within the BODY. At the moment everything is positioned ABSOLUTELY within the BODY!!

I've tried setting a div container which is relatively positioned (div id="mastheadsection") to act as a parent for all the images, but they still end up being positioned absolutely for the body rather than the masthead.

My code is:
Quote:
<div id="masthead">
<div id="mastheadsection">

<img class="imglogo" alt="" src="logo.gif" width="87" height="47" />
<img class="imgattractive"alt="" src="attractive.gif" width="598" height="36" />
<img class="imgseo"alt="" src="seo.gif" width="253" height="27" />
</div>
</div>
My CSS code is:
Quote:
.mastheadsection {
position:relative;
width: 950px;
height: 500px;
top:0px;
left:0px;
}
.imglogo {
position:absolute;
top:0px;
left:0px;
}
.imgattractive {
position:absolute;
top:100px;
left:110px;
}
.imgseo {
position:absolute;
top:130px;
left:200px;
}
Would be really grateful for any tips - I've read quite a bt but can't see where I'm going wrong.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by jj1; 07-27-2009 at 05:50 AM..
jj1 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-27-2009, 06:03 AM Re: CSS - Absolute Positioning within Masthead
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
.mastheadsection in your CSS is a class while you have NOT applied the class to the element (id only).
So the element is NOT positioned relative, therefore the absolutely positined item will NOT be constrained within the element and therefore will be positioned to the the body element
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-27-2009, 09:17 AM Re: CSS - Absolute Positioning within Masthead
jj1
Extreme Talker

Posts: 150
Trades: 0
Many thanks Chrishirst!!!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jj1 is offline
Reply With Quote
View Public Profile
 
Old 07-27-2009, 11:10 AM Re: CSS - Absolute Positioning within Masthead
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
I want to use absolute positioning to position different images and menu options ABSOLUTELY within the MASTHEAD
Why use the absolute positioning ??
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 08-02-2009, 01:54 PM Re: CSS - Absolute Positioning within Masthead
jj1
Extreme Talker

Posts: 150
Trades: 0
Quote:
Why use the absolute positioning ??
I used absolute so I could specify exactly where I wanted different images and menu buttons to go.

Problem is now solved - website seems to be working in all browsers (fingers crossed!!!) - as chrishirst said, I had mixed up class and id!! I'm afraid I'm still getting the hang of CSS.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jj1 is offline
Reply With Quote
View Public Profile
 
Old 08-02-2009, 08:29 PM Re: CSS - Absolute Positioning within Masthead
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
I used absolute so I could specify exactly where I wanted different images and menu buttons to go.
Ok, but you don't need to nail everything down with absolute positioning to achieve that
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS - Absolute Positioning within Masthead
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32193 seconds with 12 queries