Click here to Skip to main content
       

Web Development

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionA CSS QuestionmemberRoger Wright25 May '12 - 21:00 
I'm working on a website for work, just for fun, and I'm having a bit of trouble with one of the main elements. The entire page is enclosed in a DIV element of class "container." Next comes a DIV of class "header." Within the "header" DIV are two more DIV elements, classes "name" and "logo." These are used to hold the name of the company and the logo, oddly enough, with one set to float left, the other right. It's rather boring, I know, but I'm an engineer, not a designer. Still, it doesn't look bad. [^]
 
That's until you try scrolling down the page. The logo and name stay put in the browser window while the rest of the header moves up. That really wasn't what I intended, or expected. I thought that being in a containing DIV, these elements would position themselves in relation to the parent header DIV. I've tried modifying the position attribute through all the choices - relative, absolute, static, inherit, and fixed, but this behavior doesn't change. The parent container, header, has no float or position attributes, by the way, and I wonder if that might be where I should be looking for the solution.
 
Can someone provide some insight into where I'm going wrong with this?
Will Rogers never met me.

AnswerRe: A CSS Question PinmemberRichard A. Abbott25 May '12 - 22:58 
In your CSS, you have
 

a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
border: none;
position: fixed;
}
 

Change the position to relative
GeneralRe: A CSS Question PinmemberRoger Wright26 May '12 - 6:09 
Wow! How the heck did you find that? I was looking in the master page where the actual images are referenced, and didn't think to look in the stylesheet. That particular bit was auto-generated by Dreamweaver, and I never even thought to question it.
 
Thanks! Big Grin | :-D
Will Rogers never met me.

GeneralRe: A CSS Question PinmemberRichard A. Abbott26 May '12 - 6:30 
Roger Wright wrote:
How the heck did you find that?

Took a couple of seconds with the help of Firebug on Firefox browser. You can do similar with Google Chrome with the inbuilt tools or the Firebug-Lite add-in.
 
IMO, when you (or rather DreamWeaver) placed the image giving it a fixed position, it took the image out of the document flow.
GeneralRe: A CSS Question PinmemberRoger Wright26 May '12 - 7:35 
That makes perfect sense. Dreamweaver attempts to overcome the shortcomings of certain browsers who will go unnamed here by clever optimizations. Sometimes they backfire, apparently. Probably a better fix would have been to add a position:relative attribute in the DIV class affected, rather than the generic img tag style inserted by DW; that would override the default behavior for just this instance. But I'll leave it for now. Thanks, again! Big Grin | :-D
Will Rogers never met me.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid