Solved

I am trying to bring an image down without using the <br> tag but it is not working

Posted on 2011-03-07
5
315 Views
Last Modified: 2012-05-11
I am trying to bring an image down lower in a subsection but apparently it is not working.  I have a <div> followed by a sub <div> which is supposed to displace an image but it is not budging.  Any idea why?  I will show the code here of my CSS. and HTML code.  Thanks for your help ahead of time.

Here is the code that I am dealing with in the HTML file:

<div id="bottomHeader">                                    
                <div id="submenus">                                                        
                    <div id="submenu1">                    
                        <asp:HyperLink ID="submenuhyperlink1" ImageUrl="~/images/submenu1.jpg" NavigateUrl="" runat="server"></asp:HyperLink>
                    </div>                  
                </div>            
        </div>      

and here is the CSS I am dealing with in another file:

#bottomHeader {
text-align:center;
background-image:url('../images/prggroupsite_bottomheader.jpg');
height:150px;
}

#submenus {
height:105px;
width:990px;
border-color:Black;
margin-left:100px;
margin-top:10px;

}

#submenu1 {
height:98px;
width:318px;
margin-top:10px;

}

Why is the image not being displaced exactly where I want it to be?  Any solutions to this problem?  Please let me know.  Thanks!
0
Comment
Question by:VBBRett
[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
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
Chad Haney earned 250 total points
ID: 35064956
Multiple options here. Here are a couple.

1) Add padding to the div wrapping the image

#submenu1{
    padding-top:20px;
}

2) Add this to give the image margin on top

#submenu1 img{
    margin-top:20px;
}

3) Move it with position:

#submenu1{
    position:relative;
    top:20px;
}


many other options
0
 
LVL 2

Assisted Solution

by:Adjroth
Adjroth earned 250 total points
ID: 35065035
Well you have 3 (or more) possible options to use:

1) Replace margin-top under #submenu1 with padding-top
2) Completely remove #submenu1 and add padding-top:10px; to #submenus
3) Completely remove #submenu1 and add margin-top:10px; directly to your image element.

Any of these should work, but you should rarely have to use a sub-div just to add some space between elements.
0
 

Author Comment

by:VBBRett
ID: 35065173
Ok, I removed submenu1, added padding-top:20px and it didn't work.  I also added margin-top:20px; to the image and it did not work.  This is the frustrating thing that happens every so often with CSS when it doesn't respond to anything that you do.
0
 
LVL 12

Expert Comment

by:Chad Haney
ID: 35065201
Do you have a live link I can look at?
0
 

Author Comment

by:VBBRett
ID: 35065354
Well, it seems to have worked. I will try the other two images to see how they will appear.
0

Featured Post

Industry Leaders: 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

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

726 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