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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:23:04+00:00 2026-05-29T08:23:04+00:00

how to display a small number (left top border) above a border around an

  • 0

how to display a small number (left top border) above a border around an element?

basically I am looking for a way to highlight elements and identify them with a number.

UPDATE:

Basically the elements highlight on mouseover by having border property defined. on mouseout, border is transparent (disappears).

what I’d like to do is how to display a number outside of the border highlight selected?

Solution I just thought about is using a custom generated numbered image border and just use border-image dynamically

  • 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-29T08:23:06+00:00Added an answer on May 29, 2026 at 8:23 am

    Assuming you want to insert this number dynamically for any element without having to worry about relatives and absolutes here is a solution.

    enter image description here

    Code:

    <div id="box"></div>
    

    #box{
        background:red;
        height:140px;
        width:250px;
        margin:30px;
    }
    
    .number{
        background:#ccc;
        display:block;
        font-weight:bold;
        border:1px solid #000;
        font-size:10px;
    }
    

    // Create an span element that will have the number
    var number          = $("<span />").text("5").addClass("number");
    // Set the number width and height
    var numberWidth     = 10;
    var numberHeight    = 10;
    
    // Get the target element
    var element         = $("#box");
    // Get width, height and position
    var elementWidth    = element.width();
    
    // These two are only necesary if you want to position
    // the number in a different corner (e.g bottom, right)
    var elementHeight   = element.height();
    var elementPosition = element.offset();
    
    // Apply css to the number element
    // Position is based on the target element position
    number.css({
        position: "absolute",
        left:     elementPosition.left - numberWidth,
        top:      elementPosition.top  - numberHeight,
        width:    numberWidth,
        height:   numberHeight
    });
    
    // Insert the number to the body
    number.appendTo("body");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to display a large number (500+) of small circles on a form
I have a number of small images that I display that are the size
I've been looking into a number of ways to display a large number of
I display set of images(small). I need to show the larger image(300*300) at some
I have a small app which references the Microsoft.SqlServer.Smo assembly (so I can display
I'm developing a small tray-icon application for Windows and I need to display non-intrusive
I am interested in writing an application that overlays a small heads up display
I have a game engine that uses OpenGL for display. I coded a small
I have a small jquery snippet that displays notification message at the top of
In my application, I have a TextBlock that I display a Double number in

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.