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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:34:15+00:00 2026-06-05T19:34:15+00:00

I am new to JS and the Google API and I am trying to

  • 0

I am new to JS and the Google API and I am trying to make multiple markers each with a label.

From little snippets I’ve been looking at, there was no simple way to attach a label to a marker in Google Maps API v3. Between Google and stackoverflow searches, everyone used a roundabout procedure that involved creating or editing the label class.

I just want to figure out how to attach a label to each marker in a simple way since I am just starting to learn JS/ Google API v3.

Thanks

EDIT #3:
Okay I finally figured out what was wrong and correctly implemented multiple markers with labels using Lilina’s code. Apparently we both defined the var map differently and that itself makes both our codes unable to synchronize well.

I have an additional question now that I am able to use labels for each marker.
I want to be able to hide markers and their labels based on the zoom level that the user is at.

Google Maps API v3 – Different markers/labels on different zoom levels

  • 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-05T19:34:16+00:00Added an answer on June 5, 2026 at 7:34 pm

    I can’t guarantee it’s the simplest, but I like MarkerWithLabel. As shown in the basic example, CSS styles define the label’s appearance and options in the JavaScript define the content and placement.

     .labels {
       color: red;
       background-color: white;
       font-family: "Lucida Grande", "Arial", sans-serif;
       font-size: 10px;
       font-weight: bold;
       text-align: center;
       width: 60px;     
       border: 2px solid black;
       white-space: nowrap;
     }
    

    JavaScript:

     var marker = new MarkerWithLabel({
       position: homeLatLng,
       draggable: true,
       map: map,
       labelContent: "$425K",
       labelAnchor: new google.maps.Point(22, 0),
       labelClass: "labels", // the CSS class for the label
       labelStyle: {opacity: 0.75}
     });
    

    The only part that may be confusing is the labelAnchor. By default, the label’s top left corner will line up to the marker pushpin’s endpoint. Setting the labelAnchor’s x-value to half the width defined in the CSS width property will center the label. You can make the label float above the marker pushpin with an anchor point like new google.maps.Point(22, 50).

    In case access to the links above are blocked, I copied and pasted the packed source of MarkerWithLabel into this JSFiddle demo. I hope JSFiddle is allowed in China 😐

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

Sidebar

Related Questions

I'm having a problem with the new google maps api when adding multiple markers
I have been trying to create a new google custom search engine, but when
I'm trying to make use of a java api for google voice (available here:
I am trying to make a line chart by using the Google Visualization API,
I'm using the Google Maps API V3 and I'm trying to make a marker
I'm using the new Google Calendar API v3. I'm trying to obtain the users
I am trying to make a voice recognition thing with google's voice api. I
I am new with google maps api. I took some sample from the manual
I am trying to make a website using Google API V3 to show your
I am trying to make a map with multiple fusion table layers. Each fusion

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.