I want to add an icon but it doesn't show up in the web page, and yes I have downloaded 'fontawesome for the web'.
I've inspected the code and it say that the height and the width are 0x0 and I can't change it because "The display: inline property prevents width from having an effect. Try setting display to something other than inline."
.container {
padding-left: 15px;
padding-right: 15px;
margin-left: auto;
margin-right: auto;
}
/* Small */
#media (min-width: 768px) {
.container {
width: 750px;
}
}
/* Medium */
#media (min-width: 992px) {
.container {
width: 970px;
}
}
/* Large */
#media (min-width: 1200px) {
.container {
width: 1170px;
}
}
/* End Global Rules */
header {
padding: 20px;
}
header .container {
display: flex;
justify-content: space-between;
align-items: center;
}
<header>
<div class="container">
<div>
<img class="logo" src="/images/logo.png" alt="" />
</div>
<div class="Links">
<span class="icon-bar">
<i class="fa-solid fa-ba-staggered"></i>
</span>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
</div>
</header>
I have tried to inspect the code and I didn't found anything except what I've said
The easiest, and probably best, way to add any icon is as an svg element. You simply download the svg then paste in to your HTML. You can download fontawesome icons (top right on their webpage). Example:
svg {
height: 96px;
}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Pro 6.2.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M234.7 42.7L197 56.8c-3 1.1-5 4-5 7.2s2 6.1 5 7.2l37.7 14.1L248.8 123c1.1 3 4 5 7.2 5s6.1-2 7.2-5l14.1-37.7L315 71.2c3-1.1 5-4 5-7.2s-2-6.1-5-7.2L277.3 42.7 263.2 5c-1.1-3-4-5-7.2-5s-6.1 2-7.2 5L234.7 42.7zM46.1 395.4c-18.7 18.7-18.7 49.1 0 67.9l34.6 34.6c18.7 18.7 49.1 18.7 67.9 0L529.9 116.5c18.7-18.7 18.7-49.1 0-67.9L495.3 14.1c-18.7-18.7-49.1-18.7-67.9 0L46.1 395.4zM484.6 82.6l-105 105-23.3-23.3 105-105 23.3 23.3zM7.5 117.2C3 118.9 0 123.2 0 128s3 9.1 7.5 10.8L64 160l21.2 56.5c1.7 4.5 6 7.5 10.8 7.5s9.1-3 10.8-7.5L128 160l56.5-21.2c4.5-1.7 7.5-6 7.5-10.8s-3-9.1-7.5-10.8L128 96 106.8 39.5C105.1 35 100.8 32 96 32s-9.1 3-10.8 7.5L64 96 7.5 117.2zm352 256c-4.5 1.7-7.5 6-7.5 10.8s3 9.1 7.5 10.8L416 416l21.2 56.5c1.7 4.5 6 7.5 10.8 7.5s9.1-3 10.8-7.5L480 416l56.5-21.2c4.5-1.7 7.5-6 7.5-10.8s-3-9.1-7.5-10.8L480 352l-21.2-56.5c-1.7-4.5-6-7.5-10.8-7.5s-9.1 3-10.8 7.5L416 352l-56.5 21.2z"/></svg>
There is no fontAwesome icon named as fa-ba-staggered
You might be looking for:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<i class="fa-solid fa-bars-staggered"></i>
You can search on fontawesome.com/search website for any icons that you need.
Ref: https://fontawesome.com/icons/bars-staggered?s=solid&f=classic
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 months ago.
Improve this question
I want to make this type navbar responsive. I showed PC and mobile style.
enter image description here
Please help me. Thanks
I highly recommend you, use bootstrap for making this type of project easier!
but if you want a CSS-only solution here is:
pc version:
mobile version:
I added also a comment, so you can understand well
body {
/* deleting the default margin */
margin: 0;
}
.navbar {
/* setting the height of navbar */
--nav-height: 3rem;
height: var(--nav-height);
/* centering */
display: grid;
place-items: center;
/* logo: auto (less space)
input: all space width
other: auto (less space)
*/
grid-template-columns: auto 1fr auto;
/* little padding */
padding: 0 0.5rem;
/* a gap between elements of navbar */
gap: 0.5rem;
}
/* css for the menu icon */
.navbar svg {
height: calc(var(--nav-height) / 2);
padding: 0 0.5rem;
}
/* css for the container of input and menu icon */
.navbar #second-container {
display: grid;
/* menu icon take less space
input take 100% space */
grid-template-columns: auto 1fr;
/* making the container take all the space */
width: 100%;
}
/* css for the input */
.navbar #second-container input {
display: grid;
height: calc(var(--nav-height) / 2);
}
/* css for the other things on the right side of the nav*/
.navbar #third-container img {
height: calc(var(--nav-height)/ 1.5);
}
/* responsive for mobile devices */
#media (max-width: 768px) {
.navbar {
grid-template-columns: 1fr;
}
.navbar #third-container {
display: none;
}
}
<body>
<nav class="navbar">
<!-- 1 -->
<div id="first-container">
<!-- logo -->
<span>your logo</span>
</div>
<!-- 2 -->
<div id="second-container">
<!-- menu Icon -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Pro 6.1.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M0 96C0 78.33 14.33 64 32 64H416C433.7 64 448 78.33 448 96C448 113.7 433.7 128 416 128H32C14.33 128 0 113.7 0 96zM0 256C0 238.3 14.33 224 32 224H416C433.7 224 448 238.3 448 256C448 273.7 433.7 288 416 288H32C14.33 288 0 273.7 0 256zM416 448H32C14.33 448 0 433.7 0 416C0 398.3 14.33 384 32 384H416C433.7 384 448 398.3 448 416C448 433.7 433.7 448 416 448z"/></svg>
<input type="text" placeholder="search bar">
</div>
<!-- 3 -->
<div id="third-container">
<img src="https://picsum.photos/30" alt="">
<img src="https://picsum.photos/30" alt="">
<img src="https://picsum.photos/30" alt="">
<img src="https://picsum.photos/30" alt="">
<img src="https://picsum.photos/30" alt="">
</div>
</nav>
</body>
I have a logo I created using a div and two letters which I want to move inside the coral colored div. However every time I change left/right properties or margin/padding I end up changing the letter placement in the design.
I tried playing around with the CSS using developer tools but I'm still having trouble.
Is there a better way I could use to move the logo itself and maybe make it a big smaller inside the coral div? This is what I'm trying to do screenshot. *note: screenshot is from Figma but I'm trying to code what it looks like
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<!-- Faustina-->
<link href='https://fonts.googleapis.com/css?family=Faustina' rel='stylesheet'>
<!-- Didact Gothic -->
<link href='https://fonts.googleapis.com/css?family=Didact Gothic' rel='stylesheet'>
<!-- Encode Sans Semi Condensed -->
<link href='https://fonts.googleapis.com/css?family=Encode Sans Semi Condensed' rel='stylesheet'>
<!-- Stylesheet -->
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="parent">
<!-- Description -->
<div class="description">
<div class="d">DESCRIPTION</div>
</div>
<!-- Logo -->
<div class="logo">
<div class="logo-container">
<div class="box">
<div class="letter-c">C</div>
<div class="letter-p">P</div>
</div>
</div>
</div>
<!-- Navigation -->
<div class="tabs">
<nav>
<ul>
<li>About</li>
<li>Projects</li>
<li>Blog</li>
<li>Resume</li>
</ul>
</nav>
</div>
<!-- Icon -->
<div class="icon"> </div>
<!-- Contact-Footer -->
<div class="contact">
<footer>
<div class="icon-container"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="linkedin-icon">
<!--! Font Awesome Pro 6.1.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z" /></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512" class="github-icon">
<!--! Font Awesome Pro 6.1.1 by #fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" /></svg>
</div>
</footer>
</div>
</body>
</html>
CSS
.parent {
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(5, 1fr);
grid-column-gap: 0px;
grid-row-gap: 0px;
}
/****************************************************************/
/* Logo */
.logo {
grid-area: 1 / 1 / 2 / 2;
background-color: lightcoral;
}
.logo-container {
margin: 20px;
width: 100px;
height: 100px;
left: 100px;
top: 56px;
}
.letter-c {
position: absolute;
width: 31px;
height: 63px;
left: 26px;
top: 8px;
font-family: 'Faustina';
font-style: normal;
font-weight: 400;
font-size: 50px;
line-height: 63px;
/* identical to box height */
color: #DEC3C3;
-webkit-text-stroke: 2px white;
}
.letter-p {
position: absolute;
width: 27px;
height: 66px;
left: 47px;
top: 29px;
font-family: 'Didact Gothic';
font-style: normal;
font-weight: 400;
font-size: 50px;
line-height: 66px;
/* identical to box height */
color: #FFFFFF;
}
.box {
position: absolute;
width: 100px;
height: 100px;
left: 0px;
top: 0px;
background: #DEC3C3;
}
/****************************************************************/
/* Navigation */
.tabs {
grid-area: 1 / 2 / 2 / 6;
background-color: lightgreen;
}
ul {
list-style: none;
text-align: right;
margin: 20px;
}
li {
display: inline-block;
padding: 0px 10px;
font-family: 'Encode Sans Semi Condensed';
font-style: normal;
font-weight: 500;
font-size: 18px;
color: black;
}
/****************************************************************/
/* Description */
.description {
grid-area: 2 / 1 / 5 / 3;
background-color: red;
}
/****************************************************************/
/* Icon */
.icon {
grid-area: 2 / 3 / 5 / 6;
background-color: lightblue;
}
/****************************************************************/
/* Contact-Footer */
.contact {
grid-area: 5 / 1 / 6 / 6;
background-color: lightseagreen;
}
svg {
position: absolute;
width: 32px;
height: 32px;
color: #DEC3C3;
}
footer {
position: absolute;
width: 200px;
height: 50px;
left: 620px;
top: 942px;
}
.icon-container {
position: absolute;
width: 200px;
height: 50px;
left: 0px;
bottom: 0px;
background: rgba(222, 195, 195, 0.2);
border-radius: 30px;
}
.github-icon {
left: 132px;
bottom: 10px;
}
.linkedin-icon {
left: 42px;
bottom: 10px;
}
Make the following changes to .logo-container {...}:
Inside .logo-container {...}, include position: relative (to make absolute postioning of .box with respect to it, work). Then remove the margin, left and right values.
The margin property isn't necessary in .logo-container since it will cue its margins from the grid placement of its parent .logo.
The left and right properties aren't needed as well for the same reason as above (and also since, setting position: relative produces defaults of top: 0 and left: 0); remember, you are trying to position the .box div which houses the letters, not .logo-container itself. You should rather position .box from its own rule set.
If you need padding around .logo-container set it within its parent: .logo
Here's what .logo-container rule should look like:
.logo-container {
position: relative;
width: 100px;
height: 100px;
}
.box {
// Position me (w/ margin, left and right) from here instead
// if you wish to.
}
.logo {
...
// put padding around .logo-container here.
}
And VoilĂ ! Problem fixed!
If you want the .parent div to take the full height of the viewport (i.e screen), you may set height: 100vh in its CSS rule:
.parent {
...
height: 100vh;
}
Alternatively (much better way):
html,
body {
height: 100%;
}
.parent {
height: 100%;
}
If you need to remove browser default box-sizing, margin and padding properties, then add this rule set at the top of your CSS file or section:
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
My problem is when I'm going to level the icons side by side, even though I put the margin and padding I've already turned many sites, in an attempt to solve it I created this bar where the buttons are aligned as well as implemented an animation on top of them, but if I put the icons together in front of this bar, it loses the animation's integrity.
My goal is to join the icons in the upper right corner...... besides twitter/tumblr I still have 3 others...
I appreciate any and all help, I'm a beginner in programming.
/*icones tumblr, insta*/
.icones i {
display: inline-block;
width: 100%;
height: 30px;
padding: 0px 20px;
margin: 0px 5px;
}
ul {
position: absolute;
top:20%;
left: 45%;
transform: translate(-80%, -70%);
margin: 0%;
padding: 20px 0px;
background: rgb(228, 211, 228);
display: flex;
border-radius: 15px;
}
ul li a{
list-style: none;
text-align: center;
display: block;
}
#tumblr {
width: 25px;
padding-left: 700px;
}
#twitter {
width: 45px;
padding-left: 600px;
margin-top: 10px;
margin-bottom: 2em;
}
.container {
display: grid;
grid-template-columns: 4fr 2fr;
grid-template-rows: 100px 50px;
grid-template-columns: auto auto auto auto auto auto;
}
#navbar {
display: flex;
flex-direction: column;
align-items: center;
grid-column: 1 / 5;
}
<nav class="container" style="background-color:#7B68EE; height:60px; width: 100%; text-align: center; border: 3px solid">
<div class="navbar">
<div id="nave">
<p style="text-align:right; color:rgb(248, 233, 185)">
<ul>
<li> Folders</li>
<li> Files</li>
<li> Content</li>
<li> Home</li>
<li> Documents </li>
<li></li>
</ul>
<div class="navbar2">
<a href="#" class="hrv-icon-bounce">
<div id="tumblr">
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="tumblr"
class="svg-inline--fa fa-tumblr fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
<path fill="currentColor" d="M309.8 480.3c-13.6 14.5-50 31.7-97.4 31.7-120.8 0-147-88.8-147-140.6v-144H17.9c-5.5
0-10-4.5-10-10v-68c0-7.2 4.5-13.6 11.3-16 62-21.8 81.5-76 84.3-117.1.8-11 6.5-16.3 16.1-16.3h70.9c5.5 0 10 4.5
10 10v115.2h83c5.5 0 10 4.4 10 9.9v81.7c0 5.5-4.5 10-10 10h-83.4V360c0 34.2 23.7 53.6 68 35.8 4.8-1.9 9-3.2 12.7-2.2
3.5.9 5.8 3.4 7.4 7.9l22 64.3c1.8 5 3.3 10.6-.4 14.5z"></path></svg>
</div>
</a>
<a href="#" class="hrv-icon-bounce">
<div id="twitter">
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="twitter" class="svg-inline--fa fa-twitter fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299
49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969
7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828
46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 0.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg>
</div>
</a>
</p>
</div>
</div>
</div>
</nav>
I've tidied and simplified your code and added some CSS styling to make it display how I think you probably want it. I've assumed you want the text menu centred and the social icons pushed to the right. I've added comments to the CSS so hopefully you can follow what I have done.
I've made the two parts of the nav bar into separate unordered lists (ul).
I am using a flex-box layout to position and size those two sections.
I set the text menu to be flex: 1 so it expands to fill most of the space in the nav bar. This pushes the social icons to the right hand end of the bar.
One final piece of advice to you as you begin programming:
Get into the habit of being consistent with your indenting. Keeping your code tidy will help you as you develop your program or website. And it will help anyone else who may need to work on it later.
nav.navbar {
/* Use a flex-box layout to put the menu and icons side by side */
display: flex;
/* Centre the flex children (the ULs) vertically in the flex box */
align-items: center;
background-color:#7B68EE;
height:60px;
width: 100%;
text-align: center;
border: 3px solid;
}
nav.navbar .menu {
/* Removes standard list styling. Hide bullets, remove padding. */
list-style: none;
padding: 0;
/* Make menu expand to fill most of the space in the menubar */
flex: 1;
}
nav.navbar .menu li {
/* Makes menu list items display horizontally rather than vertically */
display: inline;
}
/* Add some spacing between the menu items */
nav.navbar .menu li:not(:first-child) {
padding-left: 1em;
}
nav.navbar .social-icons {
/* Removes standard list styling. Hide bullets, remove padding. */
list-style: none;
padding: 0;
}
nav.navbar .social-icons li {
/* Makes social list items display horizontally rather than vertically */
display: inline;
}
nav.navbar .social-icons svg {
width: 30px;
height: 30px;
}
<nav class="navbar">
<ul class="menu">
<li>Folders</li>
<li>Files</li>
<li>Content</li>
<li>Home</li>
<li>Documents</li>
</ul>
<ul class ="social-icons">
<li>
<a href="#" class="hrv-icon-bounce">
<svg class="tumblr" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="tumblr"role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
<path fill="currentColor" d="M309.8 480.3c-13.6 14.5-50 31.7-97.4 31.7-120.8 0-147-88.8-147-140.6v-144H17.9c-5.5
0-10-4.5-10-10v-68c0-7.2 4.5-13.6 11.3-16 62-21.8 81.5-76 84.3-117.1.8-11 6.5-16.3 16.1-16.3h70.9c5.5 0 10 4.5
10 10v115.2h83c5.5 0 10 4.4 10 9.9v81.7c0 5.5-4.5 10-10 10h-83.4V360c0 34.2 23.7 53.6 68 35.8 4.8-1.9 9-3.2 12.7-2.2
3.5.9 5.8 3.4 7.4 7.9l22 64.3c1.8 5 3.3 10.6-.4 14.5z"></path>
</svg>
</a>
</li>
<li>
<a href="#" class="hrv-icon-bounce">
<svg class="twitter" aria-hidden="true" focusable="false" data-prefix="fab" data-icon="twitter" role="img"viewBox="0 0 512 512">
<path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299
49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969
7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828
46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 0.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path>
</svg>
</a>
</li>
</ul>
</nav>
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.
I'm trying to create a 4x5 image grid. But I'm unable to get the images to align up properly. And have the correct responsive size. I'm trying to create something like this dealsource.tech. Feel like I'm failing really hard it.
Any insight will be really helpful.
.row-one {
list-style: none;
font-size: 0px;
margin-left: -2.5%;
}
.row-one li {
display:inline-block;;
padding: 10px;
margin: 0 0 2.5% 2.5%;
font-size: 16px;
font-szie: 1rem;
vertical-align: top;
box-shadow: 0 0 5px #ddd;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
.product-image img {
max-width: 50%;
height:auto;
margin:0 0 10px;
}
.product-description h3 {
text-align: center;
margin: 0 0 5px;
}
.product-description p {
text-align: center;
font-size: .9em;
line-height: 1.5em;
color: #999;
}
<section class="section-three">
<ul class="row-one">
<li>
<figure class="product-image"><img src="images/graphics cards/Asus GeForce GTX2.jpg" alt="Asus GeForce GTX2"></figure>
<figcaption class="product-description"><h3>Asus GeForce GTX2</h3>
<p>From $800 to <em>$500</em></p>
<p>Dec 29, 2016</p></figcaption>
</li>
<li>
<figure class="product-image"><img src="images/graphics cards/Gigabyte GT 420.jpg" alt="Gigabyte GT 420"></figure>
<div class="product-description"><h3>Asus GeForce GTX2</h3>
<p>From $800 to <em>$500</em></p>
<p>Dec 29, 2016</p></div>
</li>
<li>
<figure class="product-image"><img src="images/graphics cards/Gigabyte Geforce GTX 1050.jpg" alt="Gigabyte Geforce GTX 1050"></figure>
<figcaption class="product-description"><h3>Asus GeForce GTX2</h3>
<p>From $800 to <em>$500</em></p>
<p>Dec 29, 2016</p></div></figcaption>
</li>
<li>
<figure class="product-image"><img src="images/graphics cards/Gigabyte GT 420.jpg" alt="Gigabyte GT 420"></figure>
<div class="product-description"><h3>Asus GeForce GTX2</h3>
<p>From $800 to <em>$500</em></p>
<p>Dec 29, 2016</p></div>
</li>
</ul>
</section>
The easiest way to do it is through flex-box
https://jsfiddle.net/ASAP/qbxtgmf0/1/
.flexbox {
display: flex;
flex-flow: row wrap;
width: 440px; /* 4 items * item width(100+5+5) = 440 */
}
.flexbox .flex-item {
padding: 5px;
}
That product-image class only contains the images you want to resize and does not reference the images in question. In order to properly do so, you should instead use a div tag like div id="product-image" and set the height and width properties to whatever you want.
Images are hard to control their position as they are inline elements. You can use <div> instead or set the display property of the images to block.