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

  • Home
  • SEARCH
  • 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 7779591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:40:38+00:00 2026-06-01T18:40:38+00:00

I have the following code I am trying to get working correctly: <div id=newspost_bg>

  • 0

I have the following code I am trying to get working correctly:

<div id="newspost_bg">
                    <article>
                        <p>
                        <header><h3>The fast red fox!</h3></header>
                        This is where the article resides in the article tag. This is good for SEO optimization.
                        <footer>Read More..</footer>
                        </p>
                    </article>
                </div>
                <div id="newspost_bg">
                    hello
                </div>
                <div id="newspost_bg">
                    hello
                </div>
                <div id="advertisement">
                    <script type="text/javascript"><!--
google_ad_client = "ca-pub-2139701283631933";
/* testing site */
google_ad_slot = "4831288817";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
                </div>

Here is the css that goes with it:

#newspost_bg{
    position: relative;
    background-color: #d9dde1;
    width:700px;
    height:250px;
    margin: 10px;
    margin-left: 20px;
    border: solid 10px #1d2631;
    float:left;
}

#newspost_bg article{
    position: relative;
    margin-left: 20px;
}
#advertisement{
    float: left;
    background-color: #d9dde1;
    width: 125px;
    height: 605px;
    margin: 10px;
}

The problem I’m experiencing is that the advertisements im trying to get setup will align with the last with the id of newspost_bg but im looking to havce it align to the top of the container it is in. I dont know if this is enough info, if not please let me know what you might need. Im new to the web coding scene so any and all critiques help me.

  • 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-06-01T18:40:39+00:00Added an answer on June 1, 2026 at 6:40 pm

    Here are a few issues:

    First, you have a div with an article inside, which, from what I can tell isn’t necessary, since the article can take the place of the div. Then you have a p to hold the header, article body, and footer, when ps should never have header elements (h1, h3, etc) even in the older spec and it breaks the idea of using an article tag.

    Second, as mentioned, you have three divs all with the same id.

    Third, you are using relative positioning for the main divs, which I don’t think helps with the floating (maybe I’m wrong), and relative positioning really only helps for child elements that are absolute positioned.

    Having said that last point, I could be wrong, because the following works for me:

    HTML:

    <section id="articles">
        <article class="newspost_bg">
            <header><h3>The fast red fox!</h3></header>
                <p>This is where the article resides in the article tag. This is good for SEO optimization.</p>
            <footer>Read More..</footer>
        </article>
        <article class="newspost_bg">
            hello
        </article>
        <article class="newspost_bg">
        hello
        </article>
    </section>
    <aside id="advertisement">
        <script type="text/javascript"><!--
        google_ad_client = "ca-pub-2139701283631933";
        /* testing site */
        google_ad_slot = "4831288817";
        google_ad_width = 120;
        google_ad_height = 600;
        //-->
        </script>
    </aside>
    

    Notice that I’m using a section element to wrap the article elements and using the aside for the advertisment block. You could put divs inside either for further purposes, but the above is a light, utility-wrapper free document, which I think is a good place to start before adding in further divs, etc.

    CSS:

    #articles {
     position: absolute;   
    }
    #articles > article {
        background-color: #d9dde1;
        width:300px;
        height:250px;
        margin: 10px;
        margin-left: 20px;
        margin-right: -140px;
        border: solid 10px #1d2631;
    }
    
    #advertisement {
        float: right;
        background-color: #d9dde1;
        width: 125px;
        height: 605px;
        margin: 10px;
        border: 1px dashed black;
    }​
    

    Notice that the section, as the wrapper for the article elements, is set to absolute, and no other positioning, floats, or negative margins are set to the articles. The aside is set to float right, which makes it float to the top of it’s parent (in this case, we assume the body or html tag) which is also the parent of the section, so they are side by side.

    I do admit that I’m not clear why the section (or div, or whatever) has to be set to absolute for the float to actually push the others aside, but I’m sure someone else here can clear that up.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to get debugging working without an app.config. I have the following code:
I have the following code, I'm trying to get a table with 4 columns
I'm trying to use opengl in C#. I have following code which fails with
I have the following code that I am trying to extract the systems proxy
I have the following code that i am trying to change from a regular
I have the following code sample that im trying to wrap my head around
I have the following code for adding to/extracting from Zip. I'm trying to refactor
I have the following code: Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(,) (Essentially I'm trying to build a
I am trying to mock java.awt.Toolkit.beep() using JMockit Expectations. I have the following code
I am trying my hands on WPF MVVM. I have written following code in

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.