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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:25:07+00:00 2026-06-03T14:25:07+00:00

I want to have text inside a circle. Is it possible to dynamically increase

  • 0

I want to have text inside a circle. Is it possible to dynamically increase the size of the circle when the text increases?
This is an example.
But the problem for me in this example is that only the width increases along with the text.

e.g

.badge {
    background:             radial-gradient( 5px -9px, circle, white 8%, red 26px );
        background:    -moz-radial-gradient( 5px -9px, circle, white 8%, red 26px );
        background:     -ms-radial-gradient( 5px -9px, circle, white 8%, red 26px );
        background:      -o-radial-gradient( 5px -9px, circle, white 8%, red 26px );
        background: -webkit-radial-gradient( 5px -9px, circle, white 8%, red 26px );
    background-color: red;
    border: 2px solid white;
    border-radius: 12px; /* one half of ( (border * 2) + height + padding ) */
    box-shadow: 1px 1px 1px black;
    color: white;
    font: bold 15px/13px Helvetica, Verdana, Tahoma;
    height: 16px; 
    padding: 4px 3px 0 3px;
    text-align: center;
    min-width: 14px;
}

/* only needed for this sample */
.badge {
    float: left;
    left: 25px;
    margin: 6px;
    position: relative;
    top: 25px; 
}
<div class="badge">1</div>
<div class="badge">2</div>
<div class="badge">3</div>
<div class="badge">44</div>
<div class="badge">55</div>
<div class="badge">666</div>
<div class="badge">777</div>
<div class="badge">8888</div>
<div class="badge">9999</div>
  • 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-06-03T14:25:09+00:00Added an answer on June 3, 2026 at 2:25 pm

    I think you need to use javascript to adjust the height to match the width; you should also use 50% for the border-radius. I have modified your example.

    $(document).ready(function(){$('.badge').each(function(){
        $(this).height($(this).width());
        $(this).css('line-height', $(this).height()+'px');
    })});
    .badge {
        background:             radial-gradient( 5px -9px, circle, white 8%, red 26px );
            background:    -moz-radial-gradient( 5px -9px, circle, white 8%, red 26px );
            background:     -ms-radial-gradient( 5px -9px, circle, white 8%, red 26px );
            background:      -o-radial-gradient( 5px -9px, circle, white 8%, red 26px );
            background: -webkit-radial-gradient( 5px -9px, circle, white 8%, red 26px );
        background-color: red;
        border: 2px solid white;
        border-radius: 50%; /* one half of ( (border * 2) + height + padding ) */
        box-shadow: 1px 1px 1px black;
        color: white;
        font: bold 15px/13px Helvetica, Verdana, Tahoma;
        height: 16px; 
        padding: 3px;
        text-align: center;
        min-width: 16px;
    }
    
    /* only needed for this sample */
    .badge {
        float: left;
        left: 25px;
        margin: 6px;
        position: relative;
        top: 25px; 
    }
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <div class="badge">1</div>
    <div class="badge">2</div>
    <div class="badge">3</div>
    <div class="badge">44</div>
    <div class="badge">55</div>
    <div class="badge">666</div>
    <div class="badge">777</div>
    <div class="badge">8888</div>
    <div class="badge">9999</div>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file that I want to send over the network, this
Just want some direction really. Want my search box to have text inside, but
I have some text with images inside it. For example like this texttext<img src=2011-08-15/4/img/123.JPG
I have some elements that need to have the text inside editable, for this
I have an html td element with text inside. I want it so you
I have a GUID variable and I want to write inside a text file
I want to have a small text box with a scroll bar that will
I have a text file that I want to edit using Java. It has
I have some text/images that I only want to display in the normal state
I have a div with text inside of it. I want the text to

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.