Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing CSS and Divs to make a two-column layout
    primarykey
    data
    text
    <p>I'm still relatively new to css positioning, but have read a few books and watched a few tutorials. I made some palettes over at colourLovers, and wanted to see how they would look when applied to a website as a color scheme. So, using the little coding knowledge I had, I created a page to demonstrate my color scheme. After a while, it became a sort of self-confidence boost, and I've gotten just about done with it when a little thing caught my attention. </p> <p>I have a two-column layout - on the left, there is the navigation menu, with a header above and a content section to the right, all in their own divs. My question is this - when I scale the page (as in, make the window for viewing it smaller), the content section gets pushed so it wraps under the Div. The way I could fix this was to make an additional div with no bg color and make it as long as the content that contained the navigation div, so they would line up, but it doesn't fix it if you resize the window.</p> <p>I'm sure there's an easy fix to this, but my limited knowledge doesn't yet know it. If it helps, I've attached an image file below of what the site looks like in my editor (Coda). I also provide a link to the code of that page of my site which I've uploaded to textsnip. You can find it here - <a href="http://textsnip.com/f434fd" rel="nofollow noreferrer">http://textsnip.com/f434fd</a>. I have added comments to mark the header, sidebar, and content sections as well. Any help would be greatly appreciated. Thanks in advance!<img src="https://i.stack.imgur.com/QC9uD.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. COPersonally I tend to have divs for layout, and a child div in each. The parent divs (defining the layout) are positioned absolutely - so the width and height is defined in pixels. The child divs are also positioned absolutely but have padding, margin, border and content. This means the padding, margin and border will not stretch the parent divs, so they will display exactly how you want them and should not drop down to the next line when the viewport is made smaller. Another way is to use jQuery to detect resize (use `$(window).resize(function() {});`) and then resize everything as required.
      singulars
    2. COIf this is what you're looking for then I will post it as an answer so you can mark this as solved.
      singulars
    3. COHmm, alright. I currently have the divs width defined in pixels for the navigation, but the other content and header divs have percentage-based widths. The header also has a fixed height, but the content div doesn't. I don't mind if the text is scaled to a new line in the content section, I just don't want those new lines to wrap underneath my navigation menu. My first thought was to extend the parent div for the navigation to the bottom of the page, but that also adds a scrollbar to the whole page, even though there's no content left. Any way to prevent content from wrapping under divs?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload