Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6206667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:29:23+00:00 2026-05-24T05:29:23+00:00

I’m trying to position two <div> elements so that that their left sides line

  • 0

I’m trying to position two <div> elements so that that their left sides line up, like the top navigation bar and sidebar in this photo:

Enter your own goddamn description.

Normally, I would use a parent <div> to help with this. The problem is that I plan on using a PHP include() for the header and sidebar, to save copying and pasting across the site. This means that the <div> tag has to be left open at the end of the include(), to leave room for the content on the right. This seems like horrible practice, and I might forget to add </div> at the end of the page.

Is there a way to align the blocks without enclosing them in a parent container?

EDIT: Here’s what I have so far.

<!-- Common code.  Designed to be include()'d into each page. -->
<div id = "Header">
    <a href = "/"><img id = "Logo" src = "Foo.jpg"></a>
    <!-- #Logo is centered in CSS. -->

    <ul id = "TopNav">
        <li><a href = "/">Home</a></li>
        <li><a href = "Browse">Home</a></li>
    </ul>
    <!-- #TopNav is also centered in CSS. There are also
    some fancy link effects, but those are irrelevant. -->
</div>

<div id = "Sidebar">
    <!-- Contains stuff like advertisements and a 
    table of contents. -->
</div>
<!-- No CSS effects are currently applied to the sidebar, meaning it's on the
far left of the page.  I'm trying to line it up with #TopNav, which is
closer to the center.

<!-- The content section to the right of the sidebar is not included
in this file.  That's defined on a page-by-page basis.  Whatever that
content is, it should fall to the right of the sidebar.  It'd be nice
if the left side of the content never fell past the right side of the
sidebar, though not an absolute necessity. -->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:29:25+00:00Added an answer on May 24, 2026 at 5:29 am

    You can still align the two div‘s using a parent container. There is no need to worry about leaving div tags open. Just write your html/php like this:

    <div id="parent">
        <?php include 'header_sidebar.php'; ?>
        <div id="content">
        </div>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.