Solved

Background positioning with css in div

Posted on 2016-11-03
6
25 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 51

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 51

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 51

Expert Comment

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

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

708 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

19 Experts available now in Live!

Get 1:1 Help Now