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

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

Posted on 2011-03-07
5
312 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

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…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
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…

837 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