Solved

Vertical Aligning of the Text

Posted on 2015-02-24
6
76 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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 42

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

746 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

12 Experts available now in Live!

Get 1:1 Help Now