I'm still very new to css, so I'm sure this is just some really silly thing:
Does anyone know why the text is hanging off the left side of the page (on the "home" page and the "publications" page?
Thanks,
Dave
I'm still very new to css, so I'm sure this is just some really silly thing:
Does anyone know why the text is hanging off the left side of the page (on the "home" page and the "publications" page?
Thanks,
Dave
This thread shows a classic float-containment issue. When a sidebar is floated the parent container can collapse (computed height becomes zero), so following content appears to “hang” or overlap the page edge. was right to call out the include/layout mismatch: splitting opener/closer wrapper tags across files (header.shtml vs index.shtml) is brittle and often hides the real problem. ’s suggestion to clear floats also points in the right direction — clearing fixes the symptom, containment fixes the root cause. ’s final note that the site “looks fine” without an explicit clear is common, but fragile across browsers and future edits.
Checks to confirm the cause: inspect the wrapper in browser DevTools (look at computed height and whether the sidebar is floated), and check page width for horizontal overflow (long words/images can push content off-screen). If the wrapper height is zero or the sidebar has float:left while the wrapper does not contain it, use one of these fixes.
Suggested fixes (CSS examples):
/* preferred clearfix */
.clearfix::after {
content: "";
display: table;
clear: both;
} /* quick containment via BFC */
#content-wrap {
overflow: auto; /* or overflow:hidden (watch clipping) */
} Modern alternative (recommended for new layouts): avoid floats entirely and use Flexbox or Grid for a more predictable, responsive layout:
#content-wrap { display: flex; gap: 20px; }
#sidebar { width: 220px; }
#main { flex: 1; } Practical notes tied to the thread: keep high-level wrapper markup together in the main template rather than splitting open/close tags across includes (as advised). Prefer the clearfix or a BFC (overflow) to fix existing float-based layouts. For new designs, migrate to flexbox/grid to prevent recurring float issues. Finally, after applying a fix, test with long URLs/images and in multiple browsers to catch horizontal overflow or clipping.
Jump to Post— urolicious 4div#main needs to be enclosed in the div#content-wrap.
this will stop your text from "hanging out" :)
you need to change your HTML to the following:<div id="content-wrap"> <div id="sidebar"> <h1>Search Box</h1> <form action="http://www.free-css.com/" class="searchform"> <p> <input name="search_query" class="textbox" …
Jump to Post— testndtv 0You can use the clear:both attributes to fix the issue
div#main needs to be enclosed in the div#content-wrap.
this will stop your text from "hanging out" :)
you need to change your HTML to the following:
<div id="content-wrap">
<div id="sidebar">
<h1>Search Box</h1>
<form action="http://www.free-css.com/" class="searchform">
<p>
<input name="search_query" class="textbox" type="text" />
<input name="search" class="button" value="Search" type="submit" />
</p>
</form>
<h1>Sidebar Menu</h1>
<ul class="sidemenu">
<li><a href="http://www.free-css.com/">Home</a></li>
<li><a href="#TemplateInfo">Template Info</a></li>
<li><a href="#SampleTags">Sample Tags</a></li>
<li><a href="http://www.free-css.com/">More Free Templates</a></li>
<li><a href="http://www.free-css.com/">Premium Templates</a></li>
</ul>
<h1>Links</h1>
<ul class="sidemenu">
<li><a href="http://www.free-css.com/">PDPhoto.org</a></li>
<li><a href="http://www.free-css.com/">Squidfingers</a></li>
<li><a href="http://www.free-css.com/">Alistapart</a></li>
<li><a href="http://www.free-css.com/">CSS Remix</a></li>
<li><a href="http://www.free-css.com/">Dark Eye</a></li>
</ul>
</div>
<div id="main">
Home page
</div> <!--end main-->
</div> and then you need to clear #main and #sidebar.
here is a good article that explains how to clear your elements:
I see, thanks. However, I have most of the code in a header.shtml file so I can do this:
<div id="wrap">
<!--#include file="header.shtml" -->
<div id="main">
Home page
</div> <!--end main-->
</div> <!--end content wrap from header.shtml--> So that I can use the same page layout and just server side include different text for each "page" of the site. So now the header.shtml looks like:
<div id="content-wrap">
<div id="sidebar">
<h1>Some stuff</h1>
</div> <!--end sidebar--> You'll note that there is no </div> ending the content-wrap because that appears in the main files (index.shtml for example) AFTER the main-div, as you suggested. This seems a BIT goofy - is this a standard thing to do?
Thanks,
Dave
You can use the clear:both attributes to fix the issue
I see, thanks. However, I have most of the code in a header.shtml file so I can do this:
<div id="wrap"> <!--#include file="header.shtml" --> <div id="main"> Home page </div> <!--end main--> </div> <!--end content wrap from header.shtml-->So that I can use the same page layout and just server side include different text for each "page" of the site. So now the header.shtml looks like:
<div id="content-wrap"> <div id="sidebar"> <h1>Some stuff</h1> </div> <!--end sidebar-->You'll note that there is no </div> ending the content-wrap because that appears in the main files (index.shtml for example) AFTER the main-div, as you suggested. This seems a BIT goofy - is this a standard thing to do?
Thanks,
Dave
no it is not standard. what you should do is remove #content-wrap from header.shtml and instead have it like so:
<div id="sidebar">
<h1>Some stuff</h1>
</div> <!--end sidebar--> and have your index.shtml look like so:
<div id="wrap">
<div id="content-wrap">
<!--#include file="header.shtml" -->
<div id="main">
Home page
</div> <!--end main-->
</div> <!--end content wrap from header.shtml--> also remember to clear your elements or you will run into problems later on... refer to the article i linked for you or look up "how to clear floats".
Great - I guess the problem was mostly with what was contained inside the content-wrap. I didn't end up "clearing" any of the div's, but it seems to be working fine.
Thanks!
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.