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 3353164
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:07:06+00:00 2026-05-18T02:07:06+00:00

What I want to achieve is something like this. :::::::::: …hi…. ………. ………. The

  • 0

What I want to achieve is something like this.

::::::::::
…hi….
……….
……….
The hi is in the middle of the 2 colors.

I have it working for 1 color, and another color underneath, but would like the colors to split up in the middle of the text. (I’ll be using button images if no one can come up with a solution using css (Trying to avoid using images)

EDIT: Of course the css result has to be across browsers (ie 7+, FF3.0+, chrome, opera (newest))

Thanks

  • 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-18T02:07:06+00:00Added an answer on May 18, 2026 at 2:07 am

    HTML:

    <div class="fancyButton">
        <div class="background top"></div>
        <div class="background bottom"></div>
        <p>hi</p>
    </div>
    

    CSS:

    .fancyButton
    {
        width:100px;
        position:relative;
    }
    
    .fancyButton .background
    {
        width:100%;
        height:50%;
        position:absolute;
    }
    
    .fancyButton .background.top
    {
        top:0;
        background-color:red;
    }
    
    .fancyButton .background.bottom
    {
        bottom:0;
        background-color:blue;
    }
    
    .fancyButton p
    {
        position:relative;
        text-align:center;
    }
    

    Tested, and hopefully copy-pasted correctly. It uses a div that takes it’s height from the <p> inside of it. The two backgrounds are set to the top and the bottom of the button div and are 50% of it’s height so they meet nicely in the middle, no matter what height the button is. You can take out the fixed width and replace it with a left-right padding declaration for the button div if you want, so that the width is determined by the <p> too. (just realizing this and don’t want to retest)

    Nothing fancy; just solid, robust css!

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

Sidebar

Related Questions

I want to achieve something like this inside a UIView: I have created a
I want to achieve something like this but for mvc3, where user can't either
I want to achieve something like this in C# 3.5: public void Register<T>() :
I want to achieve something like this in Enterprise Architect's Communication Diagrams: start() ----------------
In .NET you can achieve something like this: Color yellowColor = Color.FromName(yellow); Is there
What I want to achieve is something like this: public void paint(Graphics g) {
the output that I want to achieve is something like this: A Anthony SL
I want to achieve something like this . Here the page automatically loads new
I'm using WPF 3.5 SP1 and I want to achieve something like this (the
Is it possible to achieve something like this: I have one picture to set

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.