Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4553834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:00:12+00:00 2026-05-21T17:00:12+00:00

I have an <div> in an <li> . In the Div is text, the

  • 0

I have an <div> in an <li>. In the Div is text, the size of that text changes.

html:

<li id="button_welcome"><div>Welcome</div></li>

css:

#about_nav li{
    height:48px;
    width:130px;
    margin-bottom:15px;
}
#about_nav li div{
    text-align:right;
    margin-right:10px;
    vertical-align:middle;
}

how do i get the text to stay in the middle of the <li>?

P.S. i have a gradient background on the <li> but i removed it because it is bulky.

cheer,

Fraser

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T17:00:13+00:00Added an answer on May 21, 2026 at 5:00 pm

    UPDATE

    If you want to use a gradient for a background, you could try the CSS way; check out the fiddle…

    http://jsfiddle.net/UnsungHero97/F5FEg/1/

    Instead, if you want to use an image, it shouldn’t affect how the text is positioned since this is a “background” image. If you do get some weird positioning, update your question and show us exactly what the problem is with code/screenshots/fiddle.


    Give it a line-height as tall as the <li>…

    #about_nav li div{
        text-align:right;
        margin-right:10px;
        line-height: 48px; /* as tall as the li */
    }
    

    Vertical alignment is a tricky business. Take a look at this article on getting a better understanding on how to vertical-align works and how to align things vertically in general…

    http://phrogz.net/CSS/vertical-align/index.html

    I hope this helps.
    Hristo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a div with a width of 200px. There is text inside that
I have the div, containig some html-formatted text like normal, <b>bold</b>, <i>italic</i> . And
Ok so the question is simple: I have a variable width and height div
<html> <head> <style type=text/css> #sidebar p { font-family: Verdana; font-size: .9em; } #sidebar .intro
I have a navigation bar/list that is using only HTML and CSS. The background
I have a text area that I want to change the font size of
I have a problem concerning CSS and HTML. I'm trying to wrap a DIV
I have 1 div and 1 text input field, the div is visible and
I have a div element containing some text. When the user clicks a word
I have a div which has some text, but according to different situations this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.