4 Replies - 762 Views - Last Post: 10 March 2012 - 02:50 PM

#1 achenn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-March 12

sidebar positioning / position:fixed not working? code/live site/image

Posted 09 March 2012 - 03:03 PM

I'm designing a blog/portfolio with three sections- header/nav is on the far left, the main content is in the vertical center, and the sidebar is on the far right. My intention is to have the header/nav in a fixed position on the left, and the sidebar in a fixed position on the right, with the main content scrolling through the vertical center.

I noticed that when I began work on the portfolio page(again, aligned with the vertical center), thus removing the main content, the sidebar moved from it's supposedly fixed position to the far left near the header/nav.

I'm having a hard time finding exactly what's causing this and I don't quite know how to ensure that the sidebar with stay to the far right regardless of what is (or isn't) in the center.

Here it is live.

<body>
    <header>
        <logo>
            <a href="#"><img src="img/logo.png" alt="whskytngfxtrt logo" height="139" width="158" /></a>
        </logo><!-- end logo -->
        <nav>
            <ul>
                <li id="blog"><a href="#">BLOG</a></li>
                <li id="work"><a href="#">WORK</a></li>
                <li id="about"><a href="#">ABOUT</a></li>
                <li id="contact"><a href="#">CONTACT</a></li>
            </ul>
        </nav><!-- end nav -->
    </header><!-- end header -->

    <work>
        <category>
            <ul>
                <h1>Web</h1>

                <h1>Print</h1>

                <h1>Identity</h1>
            </ul>

    <sidebar>
        <dictionary>
            <h3><b>hwis-kee tang-goh foks-trot</b></h3>
            <h4><p><i>noun</i> 1. the best damn creative studio there ever was</p></h4>
        </dictionary><!-- end dictionary -->

        <twitter>
            <h3>@whskytngfxtrt</h3>
            <h4><ul>
                <li><a href="#">sometimes i just really love the internet</a></li>
                <li><a href="#">sometimes i just really love the internet</a></li>
                <li><a href="#">sometimes i just really love the internet</a></li>
            </ul></h4>
        </twitter><!-- end twitter -->

header {
    background: none;
    float: left;
    margin-top: 123px;
    margin-left: 22px;
    position: fixed;
    width: 158px; 
}
main {
    float: left;
    margin-left: 300px;
    margin-top: 310px;
}
work {
    float: left;
    margin-left: 300px;
    margin-top: 310px;  
}
sidebar {
    border-top: 1px solid #202020;
    padding-top: 25px;
    float: right;
    margin-left: 153px;
    margin-top: 295px;
    position: fixed;
    width: 158px;
}
sidebar dictionary {
    position: fixed;
}

sidebar twitter {
    list-style-type: none;
    position: fixed;
}


I don't see an option to edit, but figured it was worth mentioning that the code I posted isn't the full html/css, just what I thought would be pertinent. If I missed something, let me know and I'm happy to post it.

Attached image(s)

  • Attached Image
  • Attached Image
  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: sidebar positioning / position:fixed not working? code/live site/image

#2 exiles.prx  Icon User is offline

  • D.I.C Head

Reputation: 64
  • View blog
  • Posts: 224
  • Joined: 22-November 10

Re: sidebar positioning / position:fixed not working? code/live site/image

Posted 09 March 2012 - 04:16 PM

Are you attempting to have 4 columns? Starting from the left, 1. the header/nav 2. sub header 3. main content 4. left side bar.
Was This Post Helpful? 0
  • +
  • -

#3 achenn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-March 12

Re: sidebar positioning / position:fixed not working? code/live site/image

Posted 09 March 2012 - 05:37 PM

View Postexiles.prx, on 09 March 2012 - 11:16 PM, said:

Are you attempting to have 4 columns? Starting from the left, 1. the header/nav 2. sub header 3. main content 4. left side bar.



3 columns..
1. logo & nav(fixed) 2. main content(scroll vertically) 3. sidebar(fixed)
Was This Post Helpful? 0
  • +
  • -

#4 aklo  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 229
  • Joined: 23-January 09

Re: sidebar positioning / position:fixed not working? code/live site/image

Posted 09 March 2012 - 08:10 PM

Took me awhile all because of the width and doctype (no doc type = use old rendering mode for internet explorer = break everything)

I'm not sure how flexible is this layout so I suggest you use this as a reference...because sometimes layout looks fine till you add a large image or some other tags and edit everywhere and suddenly it breaks.

BTW the html + css code you gave is missing something

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <header>
	
	<style type="text/css">
		*{
			margin:0;
		}

		#left{
			background:#FACC2E;
			height:100%;
			width:300px;
			top:0px;
			left:0px;
			position:fixed;
			z-index:9999;
		}
		
		#mid{
			background:#58FAF4;
			position:relative;
			padding-left:300px;
			padding-right:300px;
		}
		
		#right{
			background:#0080FF;
			border:1px solid black;
			height:100%;
			width:300px;
			position:fixed;
			top:0px;
			right:0px;
		}
	</style>
    </header><!-- end header -->
<body>	
	<div id="left">
		Hello world
	</div>
	
	<div id="mid">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec euismod, mi semper laoreet tincidunt, tellus dui venenatis est, eget pharetra est est eget nisi. Integer lobortis tristique neque, nec tempor risus eleifend in. Proin vel massa turpis. Vestibulum risus tortor, semper tempus consectetur eu, laoreet in purus. Praesent sagittis ipsum quis odio malesuada tempus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Ut facilisis, sem eget sagittis convallis, dui purus vestibulum leo, eu bibendum est orci quis odio. Vestibulum sodales varius libero ac molestie. Suspendisse potenti. Fusce cursus pellentesque pellentesque. Donec a elit eget tortor porttitor tristique. Phasellus placerat libero arcu. Duis sapien sem, mollis ac convallis sit amet, ultricies et tellus. Duis vitae fermentum odio. Proin ultrices, sem mollis hendrerit blandit, leo nisi dapibus nisi, et molestie nisi nibh et arcu.

Aenean hendrerit auctor nibh eu dapibus. Curabitur dictum ante nisi, at tincidunt magna. Nulla tortor mauris, eleifend at placerat vel, mollis in turpis. Donec pellentesque convallis est, ut faucibus nibh scelerisque ut. Vestibulum porta adipiscing quam at dapibus. Sed scelerisque, leo ut pellentesque lacinia, lacus lorem hendrerit risus, non malesuada tortor odio luctus quam. Nam pellentesque ornare augue non sodales. Integer vel enim vitae augue tincidunt vulputate. Duis id ipsum sit amet diam venenatis pulvinar. Nullam sed aliquet lectus. Vivamus rutrum euismod tempor. Ut sollicitudin lorem lorem, et pellentesque tellus. Cras id dolor id urna mattis consectetur. Praesent pulvinar justo sed orci aliquam ornare. Sed vulputate, nisl vitae auctor cursus, lorem metus imperdiet eros, fringilla tempus turpis velit non mauris. Morbi posuere rutrum leo, id blandit purus sagittis nec.




Donec ac elit orci. Sed semper pretium nisl, eu mattis mauris imperdiet at. Proin sollicitudin, leo id faucibus varius, urna felis luctus nunc, quis blandit tellus turpis eu ipsum. Vivamus bibendum libero sit amet tortor vehicula adipiscing. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Morbi elementum commodo justo sit amet auctor. Nullam laoreet laoreet justo. Aliquam erat volutpat. Cras vitae orci mi. Morbi aliquam vehicula massa. Praesent eget enim id erat ullamcorper malesuada. Aliquam egestas suscipit nibh in interdum. Morbi tincidunt dapibus purus ac luctus. Aliquam in est ac arcu dapibus commodo.


Nam eu lacus et libero posuere varius et porta lectus. Ut et sollicitudin est. Pellentesque tempus dolor et mauris ullamcorper molestie. Donec non augue nibh, luctus elementum nisi. Morbi hendrerit commodo purus, egestas dictum tellus suscipit et. In mi ipsum, condimentum in dictum in, tincidunt laoreet nisi. Sed ut arcu turpis. Nulla rutrum, libero ac auctor sollicitudin, lectus nulla faucibus ante, non consectetur augue lorem id mi. Nullam placerat hendrerit nisl sit amet viverra. Nullam ornare pharetra risus, tincidunt pretium lorem tincidunt blandit.


Nulla facilisi. Suspendisse euismod nisl sed ligula egestas egestas. Praesent ut enim eu sem elementum elementum. Maecenas ullamcorper volutpat cursus. Mauris vestibulum, tortor ac volutpat pulvinar, sapien mauris pulvinar dolor, sed auctor lorem mi vel augue. Vestibulum cursus interdum ipsum. Pellentesque vel metus augue. Donec ligula leo, fermentum non consectetur consequat, semper congue eros. Fusce nec dapibus neque. Aliquam porttitor ipsum eget eros imperdiet imperdiet. Nam aliquet, sem aliquet rutrum viverra, turpis lorem hendrerit nulla, aliquet hendrerit ante urna dignissim arcu. Etiam sollicitudin accumsan eros eget gravida. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.
	</div>
	
	<div id="right">
	Hello right column
	</div>
	
</body>
</html>


This post has been edited by aklo: 09 March 2012 - 08:14 PM

Was This Post Helpful? 0
  • +
  • -

#5 achenn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-March 12

Re: sidebar positioning / position:fixed not working? code/live site/image

Posted 10 March 2012 - 02:50 PM

Thank you for your suggestions.
For what it's worth- I figured out my sidebar issue.. I neglected to close a few tags in the <work> section. Once I closed them, the sidebar jumped up to where I wanted it. Thanks again.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1