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
300 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Do you have a live link I can look at?
0
 

Author Comment

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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

728 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

11 Experts available now in Live!

Get 1:1 Help Now