I am using font Segoe UI and in a particular section on the site, the font is very blurred in Google Chrome.
I am also uploading the live site: http://impressivefirm.com/dynamics365
Below are the images for comparison:
Chrome
Firefox
I don't think this has anything to do with the selected font, although there might be fonts that don't exhibit this bug. Have a look at Woodrow's answer on a similar question.
In short, the problem's root is the fact you are skewing and translating twice in order to get the hex shape .
From a specific technical point of view, I think you'll only get a clear answer from someone with intimate knowledge on how Chrome's rendering engine works and specifically how anti-aliasing is applied to text.
What's notable is that it's a rendering engine with a fairly large usage, powering Chrome, Android Browser and Opera. I believe you're roughly looking at 60 - 70% of internet users.
Looking for a practical solution, you can get around your problem by having two separate containers, one on top of each other: one containing the background of the hex, without any contents (applying the correct shape) and one transparent, not rotated or skewed at all, with the actual text. This will bring you the disadvantage of having rectangular links when you probably want hexagonal links.
The second solution, and what I believe it's the proper way to make a hex grid is the clip-path technique, combined with proper margins alignment and possibly doable with flexbox.
Edit:
Here is a trimmed down and simplified version of your example, using clip-path. I tried to keep mods to your initial CSS to a minimum and only removed what was breaking my example. Here's what I did:
removed the skews
fixed responsiveness (paddings, widths and heights - you'll probably want to adjust font sizes line heights and other details yourself)
tried to keep as much as your existing markup and CSS
removed what was breaking responsiveness and simplified a few overly-complex solutions - at least from my perspective
I haven't used any tool to calculate angles. If you want them geometrically perfect you'll want to measure them and fine-tune heights
as a general rule, I tried to demonstrating a principle, not to provide a production ready version - you'll probably need to fine-tune the details
note this technique allows for perfect control over the link areas. Clickable areas are hexagonal and the space between hexagons is not linked.
#import url('https://fonts.googleapis.com/css?family=Noto+Sans:400,700');
body {font-family: 'Noto Sans', sans-serif;background-color: #369;}
#hexGrid {
display: flex;
flex-wrap: wrap;
max-width: 840px;
margin: 0 auto;
overflow: hidden;
font-size: 1.1066819197003217rem;
line-height: 1.5rem;
list-style-type: none;
padding: 48px 0;
}
.hex {
position: relative;
outline: 1px solid transparent;
-webkit-clip-path: polygon(50% 0%, 98% 25%, 98% 75%, 50% 100%, 2% 75%, 2% 25%);
clip-path: polygon(50% 0%, 98% 25%, 98% 75%, 50% 100%, 2% 75%, 2% 25%);
background-color: white;
margin-bottom: -7vw;
box-sizing: border-box;
height: 33vw;
}
#media (min-width: 680px) {
.hex {
height: 224px;
margin-bottom: -48px;
}
}
#media (max-width: 600px) {
.hex {
height: 50vw;
margin-bottom: -10.8vw;
}
}
.hex::after {
content: '';
display: block;
padding-bottom: 86.602%;
/* = 100 / tan(60) * 1.5 */
}
.hexIn {
position: absolute;
width: 96%;
margin: 0 2%;
height: 100%;
}
.hexIn * {
position: absolute;
visibility: visible;
}
.hexLink {
display: block;
width: 100%;
height: 100%;
text-align: center;
color: #fff;
overflow: hidden;
border: none;
}
/*** HEX CONTENT **********************************************************************/
.hex h1, .hex p, .hex .icon {
width: 100%;
box-sizing: border-box;
color: #000;
font-weight: 300;
}
.hex .icon {
height: 48px !important;
top: 45%;
display: block;
z-index: 2;
transform: translate3d(0,-100%,0);
}
.hex p {
top: 60%;
z-index: 1;
transform: translate3d(0,-100%,0);
}
.hex h1 {
top: 27%;
transform: translate3d(0,100%,0);
font-size: 20px !important;
letter-spacing: 1px;
}
/*** HOVER EFFECT **********************************************************************/
/*
*.hexLink:hover h1, .hexLink:focus h1,
*.hexLink:hover p, .hexLink:focus p{
* -webkit-transform:translate3d(0,0,0);
* -ms-transform:translate3d(0,0,0);
* transform:translate3d(0,0,0);
*}
*
*/
/*** HEXAGON SIZING AND EVEN ROW INDENTATION *****************************************************************/
#media (min-width:1201px) {
/* <- 5-4 hexagons per row */
#hexGrid {
padding-bottom: 4.4%;
}
.hex {
width: 25%;
/* = 100 / 5 */
}
.hex:nth-child(7n+5) {
/* first hexagon of even rows */
margin-left: 12.5%;
/* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 1200px) and (min-width:901px) {
/* <- 4-3 hexagons per row */
#hexGrid {
padding-bottom: 5.5%;
}
.hex {
width: 25%;
/* = 100 / 4 */
}
.hex:nth-child(7n+5) {
/* first hexagon of even rows */
margin-left: 12.5%;
/* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 900px) and (min-width:601px) {
/* <- 3-2 hexagons per row */
#hexGrid {
padding-bottom: 7.4%;
max-width: 640px;
}
.hex {
width: 33.333%;
/* = 100 / 3 */
}
.hex:nth-child(5n+4) {
/* first hexagon of even rows */
margin-left: 16.666%;
/* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 600px) {
/* <- 2-1 hexagons per row */
#hexGrid {
padding-bottom: 11.2%;
}
.hex {
width: 50%;
/* = 100 / 3 */
}
.hex:nth-child(3n+3) {
/* first hexagon of even rows */
margin-left: 25%;
/* = width of .hex / 2 to indent even rows */
}
}
#media (max-width: 400px) {
#hexGrid {
font-size: 13px;
}
}
<ul id="hexGrid">
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/sales" target="_blank">
<div class="filler"></div>
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#strengthandscale"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Sales</h1>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/customer-service" target="_blank">
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#customer-service"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Customer Service</h1>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/operations" target="_blank">
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#operations"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Operations</h1>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/financials" target="_blank">
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#financials"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Financials</h1>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/field-service" target="_blank">
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#field-service"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Field Service</h1>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/project-service-automation" target="_blank">
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#project-service"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Project Service</h1>
</a>
</div>
</li>
<li class="hex">
<div class="hexIn">
<a class="hexLink" href="https://www.microsoft.com/en-us/dynamics365/marketing" target="_blank">
<svg class="icon">
<use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="assets/vectors/sprite.svg#marketing"></use>
</svg>
<p>Dynamics 365 for</p>
<h1>Marketing</h1>
</a>
</div>
</li>
</ul>
Side notes:
I'm not exactly a fan of responsiveness by percent padding, so I removed part of it, as it was really messing up responsiveness.
from where I see it, your markup and CSS are unnecessarily complex and that's the root of the problem. CSS should be kept as simple and controllable as possible.
I resolved the issue by going in Chrome to SETTINGS>>>ADVANCED>>>SYSTEM and turned off/disabled "Use Hardware Acceleration When Possible". I've seen this type of error before in the XP era - related to certain graphic driver/updates - which affected Adobe reader/full products. Remove the drivers (version translation) component specific to the browser and and the apps will default to the OS settings.
Related
I'm working with the following code which creates a series of boxes as <UL><LI> tags. The splits are separate <LI>s with a background img containing the arrows. What needs to happen is that if you resize, the arrow-LI size must not change, but the data-LI size should accommodate and shrink accordingly. To accomplish this, the arrow-LI widths are specified in px, and the data-LI in %. At all times, the entire box bar must be 1-line.
This should work, but I see that if I resize, the last box is brought out to a 2nd line, and at some point later the next-to-last box will be lowered to a 2nd line too. The text does shrink, but it should auto-shrink even more to satisfy any reasonable browser width, while the arrow LIs are fixed.
Some text e.g. "Reference Letter Deadline" did shrink, but not enough to keep everything on 1 line.
Code:
<ul class="arrowDateBoxes dateLists">
<li class="arrowDateBox1">
<div class="arrowDateBoxContent">Application Cycle Opens</div>
</li>
<li class="arrowDateBox1Arrow">
</li>
<li class="arrowDateBox2">
<div class="arrowDateBoxContent">Application Deadline</div>
</li>
<li class="arrowDateBox2Arrow">
</li>
<li class="arrowDateBox1">
<div class="arrowDateBoxContent">Reference Letter Deadline</div>
</li>
<li class="arrowDateBox1Arrow">
</li>
<li class="arrowDateBox2">
<div class="arrowDateBoxContent">Selections for Program Interviews</div>
</li>
<li class="arrowDateBox2Arrow">
</li>
<li class="arrowDateBox1">
<div class="arrowDateBoxContent">Interviews</div>
</li>
<li class="arrowDateBox1Arrow">
</li>
<li class="arrowDateBox2">
<div class="arrowDateBoxContent">Offer Acceptance Deadline Date</div>
</li>
<li class="arrowDateBox2Arrow">
</li>
<li class="arrowDateBox1">
<div class="arrowDateBoxContent">ICRC Term Begins</div>
</li>
CSS
/* Generally for all boxes */
ul.arrowDateBoxes li {
display: inline;
float:left;
font-size:14px;
font-weight: bold;
}
/* Bi-color:
data boxes (arrowDateBoxN), width as % to be flexible, and
arrow boxes (arrowDateBoxNArrow), width as px to be fixed */
/* ----------------- */
.arrowDateBox1 {
background-color: #E8E8E8;
color: #143A66;
width: 12.5%;
height: 57px;
padding-left: 15px;
}
.arrowDateBox1Arrow {
background-image: url('../images/menuarrow-split1.svg');
background-repeat: no-repeat;
width: 30.5px;
height: 57px;
}
.arrowDateBox2 {
background-color: #A9CDF1;
color: #143A66;
width: 12.5%;
height: 57px;
padding-left: 15px;
}
.arrowDateBox2Arrow {
background-image: url('../images/menuarrow-split2.svg');
background-repeat: no-repeat;
width: 30.5px;
height: 57px;
}
Per request, the SVGs (bi-colored arrow splits):
<svg xmlns="http://www.w3.org/2000/svg" width="30.541" height="57.001" viewBox="0 0 30.541 57.001">
<g id="Group_225" data-name="Group 225" transform="translate(-312.858 -383.001)">
<path id="Polygon_30" data-name="Polygon 30" d="M28.5,0,57,18.143H0Z" transform="translate(331.001 383.002) rotate(90)" fill="#e8e8e8"/>
<path id="Subtraction_11" data-name="Subtraction 11" d="M18.4,57H0L18.142,28.5,0,0H18.4Z" transform="translate(325 383.001)" fill="#a9cdf1"/>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" width="30.541" height="57.001" viewBox="0 0 30.541 57.001">
<g id="Group_225" data-name="Group 225" transform="translate(-312.858 -383.001)">
<path id="Polygon_30" data-name="Polygon 30" d="M28.5,0,57,18.143H0Z" transform="translate(331.001 383.002) rotate(90)" fill="#a9cdf1"/>
<path id="Subtraction_11" data-name="Subtraction 11" d="M18.4,57H0L18.142,28.5,0,0H18.4Z" transform="translate(325 383.001)" fill="#e8e8e8"/>
</g>
</svg>
Change the ul to display:flex. It'll keep it all on one line. You can also probably cut out a fair amount of markup by using the ::after pseudo element for your arrows. Fire over the svg (or provide a link to it) and I'll have a look.
ul.arrowDateBoxes {
display:flex;
}
/* Generally for all boxes */
ul.arrowDateBoxes li {
list-style-type: none;
font-size: 14px;
font-weight: bold;
overflow: hidden;
}
/* Bi-color:
data boxes (arrowDateBoxN), width as % to be flexible, and
arrow boxes (arrowDateBoxNArrow), width as px to be fixed */
/* ----------------- */
.arrowDateBox1 {
background-color: #E8E8E8;
color: #143A66;
width: 12.5%;
height: 57px;
padding-left: 15px;
}
.arrowDateBox1Arrow {
background-image: url('../images/menuarrow-split1.svg');
background-repeat: no-repeat;
width: 30.5px;
height: 57px;
}
.arrowDateBox2 {
background-color: #A9CDF1;
color: #143A66;
width: 12.5%;
height: 57px;
padding-left: 15px;
}
.arrowDateBox2Arrow {
background-image: url('../images/menuarrow-split2.svg');
background-repeat: no-repeat;
width: 30.5px;
height: 57px;
}
I've updated this so you only need li elements
css
.arrowDateBoxes {
display: flex;
padding: 0;
font-size: 14px;
font-weight: bold;
}
.arrowDateBoxes>li {
position: relative;
list-style-type: none;
height: 57px;
padding-left: 15px;
margin-right: 29px;
}
.arrowDateBoxes>li:nth-child(odd) {
background-color: #E8E8E8;
color: #143A66;
}
.arrowDateBoxes li:nth-child(even) {
background-color: #A9CDF1;
color: #143A66;
}
.arrowDateBoxes>li::before {
position: absolute;
left: calc(100% - 1px);
content: '';
width: 30.5px;
height: 57px;
background-repeat: no-repeat;
}
.arrowDateBoxes li:nth-child(odd)::before {
background-image: url('menuarrow-split1.svg');
}
.arrowDateBoxes li:nth-child(even)::before {
background-image: url('menuarrow-split2.svg');
}
and html
<ul class="arrowDateBoxes">
<li>
Application Cycle Opens
</li>
<li>
Application Deadline
</li>
<li>
Reference Letter Deadline
</li>
<li>
Selections for Program Interviews
</li>
<li>
Interviews
</li>
<li>
Offer Acceptance Deadline Date
</li>
<li>
ICRC Term Begins
</li>
</ul>
I'm not 100% satisfied with it as setting overflow-y: hidden doesn't work as it causes a horizontal scroll bar to appear but gives you the general idea.
When I try to size down my desktop screen navigation size of 1440px(90em) to any lower width screen, my navigation bar links start dropping off the screen. I have tried using some media query combinations, but nothing to show for it.I haven't got much experience with frontend, so I am a little bit thin on this side. Any long-term fixes to this one?Any hint on this one will be highly appreciated.
HTML header code:
<!--header-->
<header>
<nav class="nav__bar">
<a href="#" class="logo">
<img src="./images/logo.svg" alt="Sunnyside logo">
</a>
<ul class="nav__links">
<li class="nav__item">
About
</li>
<li class="nav__item">
Services
</li>
<li class="nav__item">
Project
</li>
Contact
</ul>
<img src="./images/icon-hamburger.svg" alt="toggle menu icon" class="toggle__menu">
</nav>
</header>
CSS header styles:
header {
height: 5em;
position: absolute;
left: 0;
right: 0;
}
.nav__bar {
height: 100%;
width: 90em;
margin: auto;
display: flex;
justify-content: space-between;
align-items: center;
flex: 1 1 auto;
padding: 0 2em;
}
.nav__links {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
list-style: none;
}
.nav__item {
margin: 1em;
}
.nav__link {
text-decoration: none;
font-size: 1.125em;
color: hsl(0, 0%, 100%);
font-family: 'Barlow', sans-serif;
transition: all 350ms ease-in-out;
}
.nav__link:hover {
color: hsl(232, 10%, 55%);
}
.toggle__menu {
cursor: pointer;
display: none;
}
In your example code, you set the color of the link text to white... it's white on white. But that's not fully the problem... you should also remove width:90em from the .nav_bar... it's unnecessary. see this codepen https://codepen.io/aequalsb/pen/jOmyJNp
Just simply allow the <nav> to "be itself"... which is a block level element and naturally attempts to stretch out to fit available width.
padding in CSS Sizes the margin inside a button or element. Try using margin: (how many 'px' it's going off the screen); and I've had this problem before:
SOLUTION 1:
use margin-*left or top*: *px is going off screen*
<style>
#button {
width: 100px; /* the width of the button */
position: absolute;
left: 50%; /* always 50% when centering */
margin-left: -50px; /* minus half the size of the element */
}
</style>
<button id="button">Center of page</button>
SOLUTION 2
i've had this problem before, and in best situations, use position: absolute instead of relative if you are positioning the element.
<head>
<style>
.background {
position: relative;
}
.overlap {
position: absolute;
left: 30px;
}
</style>
</head>
</style>
</head>
<body>
<!-- background-element -->
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Circle_Rufous_Solid.svg/1200px-Circle_Rufous_Solid.svg.png" class="background" width="10.5%" />
<!-- Overlap element -->
<img src="https://cdn.onlinewebfonts.com/svg/img_24930.png" class="overlap" width="10%" />
</body>
SOLUTION 3
if none of the above works, consider using javascript: device tester command and redirect to an error page with unsupported devices.
This example will detect a handful of mobile-devices, and if so, it'll redirect to 𝘩𝘵𝘵𝘱://𝘨𝘰𝘰𝘨𝘭𝘦.𝘤𝘰𝘮
<script>
if( /Android|webOS|iPhone|iPad|Mahc|Macintosh|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
window.location.href = "http://google.com";
} else {
}
</script>
NOTE: if there is big problem you cannot solve, and none of these work, its best to do research or find some articles to find your answer. Then consider using stackoverflow.
I am currently working on a website and I was wondering how I can make my website not to distort when I zoom in a and out. Zooming at 150% makes all the navigation buttons get all clustered up causing them to overlap each other. I tried using media tags which proved to work well with other devices, however, it does not seem to work when zooming in and out. (NOTE: This is my first ever website so you cna understand my confusion). Here is my code:
HTML & CSS:
*{
margin: auto;
padding: auto;
box - sizing: border - box;
font - family: Century Gothic;
}
header {
height: 15 % ;
background - size: cover;
background - position: center;
background - color: #ebebeb;
border - bottom: 5 px solid# A9A9A9;
}
#media(min - width: 768 px) and(max - width: 991 px) {
header {
height: 8 % ;
}
}
#media(min - width: 768 px) and(max - width: 1199 px) {
header {
height: 13.5 % ;
}
}
#media(min - width: 960 px) and(max - width: 1400 px) {
header {
height: 11.5 % ;
}
}
html,
body {
/* background: #000000;*/
font - size: .80e m;
/* font-family: "Balsmiq", "Lucida Grande", "Segoe UI", Arial, Helvetica, Verdana, sans-serif;*/
margin: 0 % ;
padding: 0 % ;
color: #696969;
height: 100%;
width: 100%;
}
/*Carousel*/
.carousel-container {
width: 70%;
max-height: 800px;
margin: auto;
margin-top: 1%;
overflow: hidden;
border: 5px solid white;
}
.carousel-slide {
display: flex;
width: 100%;
height: 400px;
}
# prevBtn {
position: absolute;
top: 40 % ;
z - index: 10;
left: 20 % ;
font - size: 50 px;
color: white;
opacity: 0.5;
cursor: pointer;
}
#
prevBtn: hover {
color: black;
}
#
nextBtn {
position: absolute;
top: 40 % ;
z - index: 10;
right: 20 % ;
font - size: 50 px;
color: white;
opacity: 0.5;
cursor: pointer;
}
#
nextBtn: hover {
color: black;
}
<header>
<div class="main">
<div class="logo-text">
<h1 class="text-logo">TITLE</h1>
</div>
<div class="menu-container">
<nav>
<ul>
<li>Home</li>
<li>Store</li>
<li>About</li>
<li>Contact Us</li>
</ul>
</nav>
</div>
</div>
</header>
<div class="page-wrapper">
<!--Image Slider-->
<div class="back-color">
<div class="carousel-container">
<i class="fa fa-angle-left" id="prevBtn"></i>
<i class="fa fa-angle-right" id="nextBtn"></i>
<div class="carousel-slide">
<img src="./img/testpic3.jpg" id="lastClone" alt="Could not load">
<img src="./img/testpic1.jpg" id="first" alt="Could not load">
<img src="./img/testpic2.jpg" alt="Could not load">
<img src="./img/testpic3.jpg" id="last" alt="Could not load">
<img src="./img/testpic1.jpg" id="firstClone" alt="Could not load">
</div>
</div>
</div>
There reason I included the Image slider is because it distorts aswell. When I zoom out you are able to view the other pictures which I have hidden.
Any help would be helpful. Thanks in advance!
What I think is the problem with that zooming, is, that you have specified the dimensions in percentage because of what your elements change themselves according to undefined dimensions. If you will use px or vw problem will be resolved... VW and VH are also percentages but they haves a ratio with the view port's dimensions, which prevent them from distorting their shapes on zoom. That's my take on it!
% are relative to parent elements,
whereas, vw and vh are relative to view port.
Check this link for more info
I'm trying to change the color of a floor when I hover it.
https://imgur.com/a/pXEmNXp this is the image on which I'm trying to do it.
I tried the answer on this post: How can we draw 3D bulding structure from existing image Jquery,Css? but when I actually hover the floor it doesn't work, it only shows when I hover in a random place on the bottom of the image.
How can I do it so it shows that specific floor when I hover it, and how can I actually implement the map attribute for every floor?
Here's my code if it helps:
$(document).ready(function () {
$('map').on('mouseenter', function () {
$('.highlight-4').show();
})
$('map').on('mouseleave', function () {
$('.highlight-4').hide();
})
});
.highlight {
z-index: 9999;
display: none;
pointer-events: none;
}
.building {
position: absolute;
margin-left: 11%;
box-shadow: 0 15px 30px rgba(0, 0, 0, .6);;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
HTML
<img class="highlight highlight-4" src="/static/floor-4.png" alt="">
<img class="highlight highlight-3" src="/static/floor-3.png" alt="">
<img class="highlight highlight-2" src="/static/floor-2.png" alt="">
<img class="highlight highlight-1" src="/static/floor-1.png" alt="">
<img class="highlight highlight-0" src="/static/floor-0.png" alt="">
<img usemap="#image-map" class="building" src="/static/apartments.jpeg" alt="">
<map name="image-map">
<area target="" alt="" title="" href="" coords="1121,326,197,662,191,747,1130,473,1398,664,1387,544"
shape="poly">
</map>
Best way seems to implement your building image as an SVG file with <polyline> overlays. This way you can use CSS selectors and have much more control over your layouts. You can use <a> inside SVG, javascript, etc.
I took your image and loaded it in Draw SVG to create the required top floor <polyline>. After having saved the DrawSVG drawing locally I simply copied the <polyline> into my own SVG file, which, as you can see, works without any further HTML and added some CSS to do the highlighting on :hover.
You can insert this SVG into you html as if it were an <img>, it is just another tag (with benefits).
UPDATE
Revisited the original code I posted and replaced it with completely new code. The code is now a HTML page using an SVG file with the OPs image and showing how to use an <a> with some demo text on :hover (top floor again).
The HTML page has also been made 'responsive' by using math in CSS calc() and #media queries (go 'full-page' and resize browser, also check the page on various devices with the browser Developer Tools, 'portrait' and 'landscape' mode).
Explanation of the math can be found in other answers I gave on SO:
SO 62033317
SO 61867702
Now you create the other floors....
/*
Visit below answers on Stackoverflow for an explanation
of the math used for responsive sizing of elements.
https://stackoverflow.com/a/62033317/2015909
https://stackoverflow.com/a/61867702/2015909
*/
/**************************/
/* preferred global rules */
/**************************/
html,body { box-sizing: border-box; width: 100%; max-width: 100%; height: 100% }
*::before,*::after, * { box-sizing: inherit }
body { margin: 0 }
/* responsive base font size using y = mx + b */
html { font-size: calc(0.625vmin + 0.75rem) } /* (320,14)(1280,20) */
body { font-size: 1rem }
[band] { display: flex; flex-flow: column wrap; align-content: center }
[padded="1"], [padded="0"] [band*="padded"] {
/*
responsive page padding
and responsive band padding (same as responsive page padding, but at band level)
p1(320,32) p2(1920, 72) => 0.025x + 24
p3(320, 8) p4(1920,320) => 0.195x - 54.4
'Band padding' is only active when 'page padding' is off
*/
padding: calc( 2.5vh + 24px) calc(19.5vw - 54.4px);
}
/* Making sure the image fits in any viewport, either portrait or landscape */
#media (orientation: portrait ) { #construction-site { height: auto; width: 100% } }
#media (orientation: landscape) { #construction-site { height: 100%; width: auto } }
<body padded="0">
<div id="construction-site" band="padded">
<svg viewbox="0 0 1600 1200"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<style>
.line { stroke: Black; stroke-opacity: 0; stroke-width: 2px; cursor: pointer }
.polyline { fill : Red ; fill-opacity : 0 }
.floor-text { fill: Black; stroke: none; fill-opacity: 0;
cursor: default; pointer-events: none;
font-weight: bold; font-family: sans-serif;
/* responsive font using y = mx + b */
font-size: calc(-1vmin + 51.2px); /* (320,48)(1920,32) */
}
.floor:hover>.line { fill-opacity: .4; stroke-opacity: .8 }
.floor:hover>.floor-text { fill-opacity: .7 }
</style>
<image href="https://i.imgur.com/0i4N0d3.jpg"/>
<a id="top-floor" class="floor" rel="noopener" target="_blank" href="javascript:void(0)" title="top floor, click for details...">
<polyline class="line polyline"
points="201.242,678.473 1121.43, 333.16 1370.24,
553.473 1387.74, 668.473 1127.49,
474.098 189.242, 753.473 202.242, 678.973"/>
<line class="line" x1="1121.42" y1="333.472" x2="1127.45" y2="474.097"/>
<text class="floor-text" x="800" y="150" text-anchor="middle">top floor demo text</text>
</a>
</svg>
</div>
</body>
i want to create an interactive wiki with html & css by using a semicircle and dividing the circle into different pieces for each topic. I had the following draft in mind:
https://i.stack.imgur.com/f9Oqp.png
I haven't done html and css in the context of creating own SVGs with animations.
Currently i am using this example as a starting point:
<ul class="menu">
<li class="one">
<a href="#">
<span class="icon">Category 1</span>
</a>
</li>
<li class="two">
<a href="#">
<span class="icon">Category 2</span>
</a>
</li>
<li class="three">
<a href="#">
<span class="icon"> Category 3</span>
</a>
</li>
<svg height="0" width="0">
<defs>
<clipPath clipPathUnits="objectBoundingBox" id="sector">
<path fill="none" stroke="#111" stroke-width="1" class="sector" d="M0.5,0.5 l0.5,0 A0.5,0.5 0 0,0 0.75,.066987298 z"></path>
</clipPath>
</defs>
</svg>
$base: #A5E2F3;
.menu {
padding: 0;
list-style: none;
position: relative;
margin: 30px auto;
width: 70%;
height: 0;
padding-top: 70%;
}
#media all and (max-width: 320px) {
.menu {
width: 230px;
height: 230px;
padding: 0;
}
}
#media all and (min-width: 700px) {
.menu {
width: 500px;
height: 500px;
padding: 0;
}
}
.menu li {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
clip-path: url(#sector);
/* try this one in Chrome/Opera/Safari */
/* clip-path: polygon(50% 50%, 100% 50%, 75% 6.6%); */
a {
display: block;
width: 100%;
height: 100%;
}
&:hover {
background-color: gold;
}
}
.one {
background-color: $base;
transform: rotate(0deg);
}
.two {
background-color: darken($base, 7%);
transform: rotate(-60deg);
}
.three {
background-color: darken($base, 14%);
transform: rotate(-120deg);
}
.icon {
position: absolute;
/* exact values here depend on what you are placing inside the items (icon, image, text, etc.) */
right: 15%;
top: 30%;
/* make sure it it rotated enough; angle of rotation = angle of the sector itself */
transform: rotate(60deg);
/* style further as needed */
color: darken($base, 60%);
font-family: Indie Flower;
font-size: 25px;
}
p {
text-align: center;
width: 80%;
margin: 0 auto;
}
These are my question about this task:
1) How can i create interactive buttons
- click on the button will make the remaining buttons disappear
- 1/3 semicircle will expand to a 1/4 semicicircle
2) How can i improve the clicks with animations
- Button Grows from 1/3 to 1/4 semicircle
Thank you in advance!
To answer your questions:
1). An interactive button can be created in many ways, personally I would do something like this in HTML:
<button type="button" data-toggle="menuItem">Toggle</button>
and then in JavaScript (using jQuery) you can check for when this button is clicked:
$("button[data-toggle='menuItem']").on("click", function () {
// - Do your toggle logic in here
// - Do '.hide()' on all buttons that aren't '$(this)'.
// - Add class to '$(this)' to make it expand.
});
2). It really depends on how you're creating your semi-circles but I would say your best cross-browser solution would be to look into the CSS 'transition' property a bit more: W3Schools CSS transition Property
I hope this helps, let me know if you don't understand something I've said.