Solved

Vertical Aligning of the Text

Posted on 2015-02-24
6
79 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

785 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