Solved

Background positioning with css in div

Posted on 2016-11-03
6
30 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
  • 3
  • 2
6 Comments
 
LVL 56

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 56

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 56

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

Suggested Solutions

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

762 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