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
Solved

Background positioning with css in div

Posted on 2016-11-03
6
29 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 55

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 55

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 55

Expert Comment

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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS issue in Nested Master Pages 9 26
Make options hidden and show just option that is on 1 29
really easy css change help please 4 18
send email part1 9 26
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

839 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