Solved

Vertical Aligning of the Text

Posted on 2015-02-24
6
83 Views
Last Modified: 2015-02-25
Hello Experts,

I have the following HTML for the "First", "Previous", "Next" and "Last" arrow images with text " x of y" in between "Previous" and "next" :
<div class="navigation">
            <img src="../images/first.gif">
            <img src="../images/previous.gif">
            <p>x of y</p>
            <img src="../images/next.gif">
            <img src="../images/last.gif">
            <br><br>
            </div>

Open in new window


And I am trying to make text  " x of y" vertically aligned with images with the following CSS, but the texts is sliding down:
.navigation{
    margin-left: 250px;
    
}
.navigation img{
    width: 30px;
    height: 30px;
}

.navigation p{
    display:inline;
    font-size: 130%;
    vertical-align: middle;
   
}

Open in new window


What am I doing wrong?

Thank you
0
Comment
Question by:APD_Toronto
[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
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:Jeffrey Dake
ID: 40629672
You probably don't have the right line-height.  Try setting that up to 30px.
0
 

Author Comment

by:APD_Toronto
ID: 40629692
I don't understand.

Just to clarify, I am trying to make the text vertically centered against the images. I

I added line-height: 30px, but nothing helps.
0
 
LVL 10

Expert Comment

by:Jeffrey Dake
ID: 40629717
I was saying try

.navigation p
{
    display:inline;
    font-size: 130%;
    vertical-align: middle;
    line-height: 30px;   
}

Open in new window


If that doesn't work can you send the entire html file and css?  Or is there a link that can be accessed to be debugged.  I am kind of guessing what the rest of your css is doing.
0
Technology Partners: 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!

 

Author Comment

by:APD_Toronto
ID: 40629725
Still doesn't work

here is my entire CSS:
fieldset {
    margin-top: 20px;
    margin-bottom: 0.5em;
    padding-top: .5em;
    
    margin-left: 400px;
    margin-right: 400px;
   
    
}
input {
    width: 18em;
}
input.required {
    border: 2px solid black;
}

label {
    float: left;
    width: 10em;
    text-align: right;
}

label.required {
    font-weight: bold;
}

.button{
    width: 9em;
    border: 2px solid black;
    border-radius: 4px;
    background-color:RGBA(153,212,254,0.30);
    margin-bottom: 10px;
    
}
.addedit{ 
   padding-top: 20px;
   margin:20px 320px;
   padding-left: 200px;
  
}
.addedit input{
    width:11em; 
    padding:2px;
}
.list{
   padding-top: 20px;
   margin:20px 100px;
   padding-left: 200px;
   padding-bottom: 20px;
   
}
.list input{
    width: 8em;
}

#user_list{
    padding-top: 40px;
    padding-left: 230px;
}
#add_usersbtn{
    width: 12em;
    margin-left: 15px;
    padding: 1px;
}
#return_to_addbtn{
    width: 12em;
    padding: 1px;
}
#return_to_dispatchbtn{
    width: 12em;
    padding: 1px;
}

.navigation{
    margin-left: 250px;
    line-height: 30px;
}
.navigation img{
    width: 30px;
    height: 30px;
}

.navigation p{
    display:inline;
    font-size: 130%;
    vertical-align: middle;
    line-height: 30px;
    
}

Open in new window

0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 40629728
You need to add vertical-align to the images, not the text:

.navigation img{
    width: 30px;
    height: 30px;
    vertical-align:middle;
}

Open in new window


Here's a working demo -> http://jsfiddle.net/ChrisStanyon/p17q0ugm/
0
 

Author Closing Comment

by:APD_Toronto
ID: 40630992
Thanks
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Find out what you should include to make the best professional email signature for your organization.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

688 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