Solved

Background positioning with css in div

Posted on 2016-11-03
6
32 Views
Last Modified: 2016-11-27
Hi I have the below html.  There is a graphic in the div id="Header".  I want to put the div's for classes photobox for the graphics in the div officers on the bottom portion (over it)  of the header.

You can see this live at    http://www.cleanslatelocal118.com/index.aspx

<body>  
    <div id="Wrapper">
        <div id="Header"></div>
        <div class="clear"></div>
        <div id="officers">
            <div class="photobox"><img class="photo" src="images/a.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/b.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/b.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/d.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/e.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/f.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/g.png" alt="" />text</div>
            <div class="photobox"><img class="photo" src="images/h.png" alt=""/>text</div>
        </div>
    </div>
</body>

CSS for this is:

      #Wrapper
        {
            margin: 0 auto;
            max-width:1200px;
        }
       
       #Header
        {          
            margin: 0 auto;
            width: 1100px;
            height: 455px;
            background: url(images/background.png) 0 0 no-repeat;
            float:left;
        }  
           
        #officers        
        {
            background-color:#294143;
            height:200px;
            width:1100px;
            float:left;            
        }
       
        .photobox
        {
            height:200px;
            width:105px;
            padding:10px 3px 3px 3px;
            text-align:center;
            float:left;
            font-family:Calibri;
            font-size:.7em;
            color:White;      
        }

        .clear
        {
           clear:both;
        }
0
Comment
Question by:Charles Baldo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 57

Accepted Solution

by:
Julian Hansen earned 500 total points (awarded by participants)
ID: 41872892
Do you mean like thisss85.jpg
To get this do the following
1. move your Officers inside your header
<body>  
    <div id="Wrapper">
        <div id="Header">
          <div id="officers">
              <div class="photobox"><img class="photo" src="images/a.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/b.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/b.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/d.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/e.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/f.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/g.png" alt="" />text</div>
              <div class="photobox"><img class="photo" src="images/h.png" alt=""/>text</div>
          </div>
       </div>
        <div class="clear"></div>
    </div>
</body>

Open in new window

Now fix your styling
i. Make header position: relative
#Header {          
  margin: 0 auto;
  width: 1100px;
  height: 455px;
  background: url(images/background.png) 0 0 no-repeat;
  float:left;
  position: relative;
}  

Open in new window

ii. Remove the background from the officers container and make it position absolute positioned at the bottom
#officers {
  height:200px;
  width:1100px;
  float:left;            
  position: absolute;
  bottom: 0;
}

Open in new window

0
 

Author Comment

by:Charles Baldo
ID: 41873233
Nice I see you mix the absolute with the relative positions , thanks again for your excellent help
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 41873446
I see you mix the absolute with the relative positions
Necessary to make sure the children (photobox) are positioned relative to their parent.

You can read more about background images and positioning in this article https://www.experts-exchange.com/articles/28823/4-Methods-for-creating-image-overlays-in-HTML-using-CSS-and-PHP-GD2.html
0
 

Author Comment

by:Charles Baldo
ID: 41879760
Thank you worked well.  I thought I already assigned you points?
0
 
LVL 57

Expert Comment

by:Julian Hansen
ID: 41879944
I thought I already assigned you points?
Question appears to still be open.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question