Hack Forums
How to make a div sidebar? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Webmasters (https://hackforums.net/forumdisplay.php?fid=141)
+---- Forum: Website Construction (https://hackforums.net/forumdisplay.php?fid=50)
+---- Thread: How to make a div sidebar? (/showthread.php?tid=5567042)



How to make a div sidebar? - Mik3y - Mar 5, 2017

I want to have a sidebar that is not a fixed sidebar.


Every time I try to float my sidebar to the left it goes to the left, except it stays underneath the div on top of it. Could anyone help me out?


* - Nerdi - Mar 5, 2017

(Mar 5, 2017 08:40 AM)Mik3y Wrote:  I want to have a sidebar that is not a fixed sidebar.
Every time I try to float my sidebar to the left it goes to the left, except it stays underneath the div on top of it. Could anyone help me out?

Are you using float:left; and float:right; in your CSS?
You should also make sure you set a width to each, such as width:40%; for sidebar, and width:60% for whatever the main content is.

You should post some of your code and we'll fix it up for you 🙂


* - D2key - Mar 5, 2017

Have to make sure both divs can fit. Also don't forget to clear your floats


* - killero - Mar 7, 2017

I think clear:both will fix your problem.
However showing us your code would help a lot.


* - Rushax - Mar 7, 2017

Also if you're setting width of sidebar to say 40% and rest of the content to 60% make sure you've cleared all the paddings & margins with a CSS reset.


* - Ajs Nigrutin - Mar 9, 2017

I would recommend Frameworks like Bootstrap. With "col" you can make columns of diferent size. Its easy that way to make a grid and get what you want.
Anyways it would be good if you put some code from your problem i think you putted div's in a wrong way (Some rule of parent isnt alowing your changes in CSS)