Solved

Background positioning with css in div

Posted on 2016-11-03
6
27 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:charlesbaldo
  • 3
  • 2
6 Comments
 
LVL 52

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:charlesbaldo
ID: 41873233
Nice I see you mix the absolute with the relative positions , thanks again for your excellent help
0
 
LVL 52

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:charlesbaldo
ID: 41879760
Thank you worked well.  I thought I already assigned you points?
0
 
LVL 52

Expert Comment

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

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now