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
311 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error on link 14 48
Add css and js to MVC Project not in project 9 37
Capture logon name 13 73
Why my select dropdown does not work? 8 41
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 …
When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

810 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