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

Vertical Aligning of the Text

Posted on 2015-02-24
6
80 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
  • 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
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…

790 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