Solved

Vertical Aligning of the Text

Posted on 2015-02-24
6
82 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
Industry Leaders: 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

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!

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.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
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).

736 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