?
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
Medium Priority
?
325 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 1000 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 1000 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

765 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