Posted in CSS
4794
12:44 am, August 24, 2022
 

Map Image with Easy Dots and Titles using only CSS

I had to quickly add some dot points with names to a map the other day, so i thought i should probably look for a jquery library for tool tips or something similar. But then i thought why not just add these elements as CSS and then utilize the hover attribute to hide and show the labels. 

Read the full details of this code over here

HTML

<div class='map-wrap'>
  <div class='map-dot map-dot-1'>
    <div class='dot-content'>
      KruXoR 1
    </div>
  </div>
  <div class='map-dot map-dot-2'>
    <div class='dot-content'>
      KruXoR 2
    </div>
  </div>
</div>

CSS

.map-wrap * {
	font-family:sans-serif;
}
.map-wrap {
	background:url(https://i.imgur.com/qHVGYKx.jpeg) center no-repeat;
	background-size:cover;
	height:500px;
	width:800px;
	margin:0 auto;
	position:relative;
}
.map-dot:hover .dot-content {
  display:block!important;
}
.dot-content {
  background:rgba(255,255,255,0.8);
  padding:10px;
  border-radius:10px;
  box-shadow:1px 1px 10px rgba(0,0,0,0.3);
  min-width:150px;
  font-size:14px;
  text-align:center;
	display:none;
	font-weight:bold;
  color:#444;
}
.map-dot:hover {
  background:rgba(255,255,255,0.0);
}
.map-dot {
  background:rgba(255,255,255,0.5);
  border-radius:20px;
	height:30px;
	width:30px;
	position:absolute;
}
.map-dot-1 {
	top:374px;
	left:212px;
}
.map-dot-2 {
	top:10%;
	left:10%;
}
KruXoR 1
KruXoR 2

External Link for Map Image with Easy Dots and Titles using only CSS

View Statistics
This Week
43
This Month
287
This Year
745

No Items Found.

Add Comment
Type in a Nick Name here
 
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better. You won't believe what you can accomplish by attempting the impossible with the courage to repeatedly fail better.
Unknown
Random CSS Property

@charset

The @charset CSS at-rule specifies the character encoding used in the style sheet. It must be the first element in the style sheet and not be preceded by any character; as it is not a nested statement, it cannot be used inside conditional group at-rules. If several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the character set of the HTML page is relevant.
@charset css reference