CSS borders appearing and disappearing in MS Edge - html

My website code has an annoying problem. Whenever I view the page with Microsoft Edge and hover over a link, one of the borders turns and stays white until you hover over another link, which switches another border.
body {
font-family: Sans-Serif;
background-color: blue;
}
.Overhead {
background-color: red;
background-image: url('cats.jpg');
}
.Title {
margin: 5px;
}
.Active {
background-color: rgba(255, 255, 255, 1);
}
.Menu {
overflow: hidden;
}
.Menu a {
transition: .5s ease;
display: block;
text-align: center;
text-decoration: none;
color: grey;
padding: 5px;
float: left;
width-max: 50px;
background-color: rgba(255, 255, 255, 0.5);
}
.Menu a:visited {
color: grey;
}
.Menu a:hover {
background-color: rgba(255, 255, 255, 1);
}
<div class="Overhead">
<h1 class="Title">Title</h1>
<div class="Menu">
<a class="Active" style="background-color: rgba(255,255,255,1);"><b>Home</b></a>
<a><b>About</b></a>
<a><b>Service</b></a>
<a><b>Contact</b></a>
</div>
</div>
I'm looking for a way to change the CSS so the borders stop appearing. I tried to completely get rid of the border, but that didn't work. Is there any way to fix this?

if you don't want a border, just do this
border: 0px solid black;
this will make it so there isn't a border, if you ever see one.
In your code up there, there isn't a border, so use this if you see your border.
Note: it could just be border: 0px;, but I haven't tried it.
$('.a').mouseenter(function() {
$(this).css("border", "0px")
$(this).css("background-color", "rgba(255, 255, 255, 1)");
$(this).css("transition", "0.3s");
});
$('.a').mouseleave(function() {
$(this).css("border", "0px")
$(this).css("background-color", "rgba(255, 255, 255, 0.5)");
$(this).css("transition", "0.3s");
});
body {
font-family: Sans-Serif;
background-color: blue;
}
.Overhead {
background-color: red;
background-image: url('cats.jpg');
}
.Title {
margin: 5px;
}
.Active {
background-color: rgba(255, 255, 255, 1);
}
.Menu {
overflow: hidden;
}
.Menu a {
transition: .5s ease;
display: block;
text-align: center;
text-decoration: none;
color: grey;
padding: 5px;
float: left;
width-max: 50px;
background-color: rgba(255, 255, 255, 0.5);
}
.Menu a:visited {
color: grey;
}
.head {
border: 0px solid black;
}
#service {
margin-left: 0.4px;
}
#contact {
margin-left: 0.35px;
}
}
#container {
background-color: rgba(255, 255, 255, 0.5);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="Overhead">
<h1 class="Title">Title</h1>
<div class="Menu">
<div id="container">
<a class="Active" style="background-color: rgba(255,255,255,1);"><b>Home</b></a>
<a id="about" class="a"><b class="head">About</b></a>
<a id="service" class="a"><b class="head">Service</b></a>
<a id="contact" class="a"><b class="head">Contact</b></a>
</div>
</div>
</div>

I could replicate your problem. it is not a border, but actually two semi-transparent white backgrounds overlap in Ms Edge and creates a bolder white line. you can add margins between items in the menu, or a better solution could be to apply background-color: rgba(255, 255, 255, 0.5); to .Menu instead (set transparent background for menu items and keep the transition to white background on hover).

If you're using Microsoft Edge, this is because it's an Edge browser glitch. You will need to edit this so that it renders in MS Edge or just bear with it right now. Try placing space between the navbar items

Related

Border opacity in css using rgba() not working

I am working on a simple login site template using html and css (no js yet) and for some reason when I use the border-color property in my css for the .main class and i use the rgba() function like this:
border-color: rgba(255, 255, 255, 0.5);
the rgb works but the alpha does not at all.
I tried doing this instead and i also removed the original line:
border: 60px solid rgba(255, 255, 255, 0.5);
I am using chrome version 108.
html {
height: 100%;
width: 100%;
font-family: Arial, Helvetica, sans-serif;
background-image: linear-gradient(red, lime);
}
.main {
margin: 60px;
border: 60px solid;
border-color: rgba(255, 255, 255, 0.5) !important;
/* Set border opacity */
border-radius: 30px;
background-color: rgba(255, 255, 255, 0.8);
}
.main input {
border-radius: 10px;
height: 30px;
background-color: lightgray;
}
.main input:focus {
background-color: white;
}
.main button {
height: 30px;
border-radius: 15px;
}
<center>
<div class="main">
<h1>Login</h1>
<p>Hello! To continue please log into our service:</p>
<h2>Email</h2>
<input type="email">
<h2>Password</h2>
<input type="password">
<br>
<br>
<button type="button" onclick='alert("logging in...")'>Login</button>
</div>
</center>
You need to add background-clip: padding-box; to limit the background to padding area and not have it under your border-color:
html {
height: 100%;
width: 100%;
font-family: Arial, Helvetica, sans-serif;
background-image: linear-gradient(red, lime);
}
.main {
margin: 60px;
border: 60px solid;
border-color: rgba(255, 255, 255, 0.5);
/* Set border opacity */
border-radius: 30px;
background-color: rgba(255, 255, 255, 0.8);
background-clip: padding-box
}
.main input {
border-radius: 10px;
height: 30px;
background-color: lightgray;
}
.main input:focus {
background-color: white;
}
.main button {
height: 30px;
border-radius: 15px;
}
<div class="main">
<h1>Login</h1>
<p>Hello! To continue please log into our service:</p>
<h2>Email</h2>
<input type="email">
<h2>Password</h2>
<input type="password">
<br>
<br>
<button type="button" onclick='alert("logging in...")'>Login</button>
</div>
I took a look and there's no issue.
You created two styles very similar and with 50% or more of opacity:
border-color: rgba(255, 255, 255, 0.5)
background-color: rgba(255, 255, 255, 0.8)
I suggest you to create a good contrast between the .main background and border.
In front-end, you will need to learn about design too. So, one of the videos I suggest you to learn how to manage colors is: https://youtu.be/Qj1FK8n7WgY?list=PLAiIx7LPQuH3FN2B2oBNiWhPCBC2NdqDe
I believe that a better contrast between the background and border, and an opacity below 50% will solve your problem.

Align li containing svg, with other li containing font-awesome icons [duplicate]

This question already has answers here:
Align inline-block DIVs to top of container element
(5 answers)
Closed 1 year ago.
FontAwesome is missing one Icon and as such I have to fall back to using an svg.
<ul class="icons other">
<li><a>
<svg width="50" height="50">...</svg>
</a></li>
<li><a class="fab fa-soundcloud"></a></li>
<li><a class="fab fa-spotify"></a></li>
</ul>
with the following styling (scss),
.icons {
>li {
display: inline-block;
padding: 0;
>a, svg {
height: 50px;
width: 50px;
line-height: 50px;
font-size: 1.8em;
text-align: center;
border-radius: 50%;
color: rgba(255, 255, 255, 0.8);
box-shadow: 0 0px 2px rgba(255, 255, 255, 0.56);
}
.fab {
background-color: black;
}
}
}
Here is a demo fiddle: https://jsfiddle.net/Cains/owarL5p1/
As li are inline items, make them vertically middle, and make a as block elements because height width won't work on inline elements.
.icons {
>li {
display: inline-block;
padding: 0;
vertical-align:middle; /*** added this ***/
>a, svg {
height: 50px;
width: 50px;
line-height: 50px;
font-size: 1.8em;
text-align: center;
border-radius: 50%;
color: rgba(255, 255, 255, 0.8);
box-shadow: 0 0px 2px rgba(255, 255, 255, 0.56);
display:block; /*** added this ***/
}
.fab {
background-color: black;
}
}
}
https://jsfiddle.net/dk8eLcfm/
Edit: after #TemaniAfif comment.
Though above solution also worked, but I agree with Temani afif's point that, we can give vertical-align:top to svg, as it's also an inline element and can remove display block from a.
.icons {
>li {
display: inline-block;
padding: 0;
vertical-align:middle;
>a, svg {
height: 50px;
width: 50px;
line-height: 50px;
font-size: 1.8em;
text-align: center;
border-radius: 50%;
color: rgba(255, 255, 255, 0.8);
box-shadow: 0 0px 2px rgba(255, 255, 255, 0.56);
svg{
vertical-align:top;
}
}
.fab {
background-color: black;
}
}
}
https://jsfiddle.net/2bcamf86/1/
You can simply use display: flex to ul.icons
ul.icons.other { display: flex; }

How to center "position: relative"-navigation bar?

How can I center a navigation bar with the position property set to relative? It's for this website.
I've found several solutions for doing that, but that requires me to change the position of the navigation bar to absolute. I can't do that, since that ruins the entiry css style for the navigation bar!
body header .bottom-header {
border-radius: 15px 0 0 0;
width: 100%;
height: 125px;
background: linear-gradient(to right, #381107, #993013, #FF5221);
text-align: center;
}
body header .bottom-header ul {
position: relative;
top: 32%;
list-style-type: none;
margin: 0;
padding: 0;
}
body header .bottom-header ul li a {
transition: all .4s ease;
color: rgba(255, 255, 255, 0.4);
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
font-size: 14px;
}
body header .bottom-header .button {
transition: all .4s ease;
display: block;
float: left;
top: 40px;
margin: auto;
min-width: 13%;
max-width: 13%;
padding-top: 8px;
padding-bottom: 8px;
border: 2px solid rgba(255, 255, 255, 0.4);
border-radius: 12px;
margin-left: 0.4%;
margin-right: 0.4%;
cursor: pointer;
}
body header .bottom-header .button:hover {
border: 2px solid rgba(255, 255, 255, 0.7);
}
body header .bottom-header .button:hover a {
color: rgba(255, 255, 255, 0.7);
}
<center>
<div class="bottom-header">
<ul>
<li class="button" id="top" style="margin-left: 1%;" onclick="window.location='hem.html';">Hem</li>
<li class="button" id="top" onclick="window.location='om.html';">Om Mango</li>
<li class="button" id="top" onclick="window.location='filosofi.html';">Filosofi</li>
<li class="button" id="top" onclick="window.location='personal.html';">Personal</li>
<li class="button" id="bottom-start" onclick="window.location='kontakt.html';">Kontakt</li>
<li class="button" id="bottom" onclick="window.location='hitta-hit.html';">Hitta hit</li>
<li class="button" id="bottom" onclick="window.location='bostaderna.html';">Verksamheterna</li>
</ul>
</div>
</center>
What I've done to center it (which really isn't a good solution) is, I change the margin on each side of the navigation bar depending on the total width of the page. Like you can see if you take a look at the css of the page i linked before. Thank you!
Make yout ul a relatively positioned inline-blockand use margin: 0 auto; on it to center it. And erase all width settings from the lielements / buttons, so they can have the width necessary for their text contents:
.bottom-header {
border-radius: 15px 0 0 0;
width: 100%;
background: linear-gradient(to right, #381107, #993013, #FF5221);
text-align: center;
}
.bottom-header ul {
position: relative;
display: inline-block;
margin: 0 auto;
list-style-type: none;
padding: 0;
}
.bottom-header ul li a {
transition: all .4s ease;
color: rgba(255, 255, 255, 0.4);
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
font-size: 14px;
}
.bottom-header .button {
transition: all .4s ease;
display: block;
top: 40px;
padding-top: 8px;
padding-bottom: 8px;
border: 2px solid rgba(255, 255, 255, 0.4);
border-radius: 12px;
cursor: pointer;
}
.bottom-header .button:hover {
border: 2px solid rgba(255, 255, 255, 0.7);
}
.bottom-header .button:hover a {
color: rgba(255, 255, 255, 0.7);
}
<div class="bottom-header">
<ul>
<li class="button" id="top" onclick="window.location='hem.html';">Hem</li>
<li class="button" id="top" onclick="window.location='om.html';">Om Mango</li>
<li class="button" id="top" onclick="window.location='filosofi.html';">Filosofi</li>
<li class="button" id="top" onclick="window.location='personal.html';">Personal</li>
<li class="button" id="bottom-start" onclick="window.location='kontakt.html';">Kontakt</li>
<li class="button" id="bottom" onclick="window.location='hitta-hit.html';">Hitta hit</li>
<li class="button" id="bottom" onclick="window.location='bostaderna.html';">Verksamheterna</li>
</ul>
</div>
In case you want the buttons aligned horzontally (i.e. other than in the code you posted), apple diplay: inline-block to the lielements, and maybe a fixed min-width setting:
.bottom-header {
border-radius: 15px 0 0 0;
width: 100%;
background: linear-gradient(to right, #381107, #993013, #FF5221);
text-align: center;
}
.bottom-header ul {
position: relative;
display: inline-block;
margin: 0 auto;
list-style-type: none;
padding: 0;
}
.bottom-header ul li a {
transition: all .4s ease;
color: rgba(255, 255, 255, 0.4);
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
font-size: 14px;
}
.bottom-header .button {
transition: all .4s ease;
display: inline-block;
min-width: 90px;
top: 40px;
padding-top: 8px;
padding-bottom: 8px;
border: 2px solid rgba(255, 255, 255, 0.4);
border-radius: 12px;
cursor: pointer;
}
.bottom-header .button:hover {
border: 2px solid rgba(255, 255, 255, 0.7);
}
.bottom-header .button:hover a {
color: rgba(255, 255, 255, 0.7);
}
<div class="bottom-header">
<ul>
<li class="button" id="top" onclick="window.location='hem.html';">Hem</li>
<li class="button" id="top" onclick="window.location='om.html';">Om Mango</li>
<li class="button" id="top" onclick="window.location='filosofi.html';">Filosofi</li>
<li class="button" id="top" onclick="window.location='personal.html';">Personal</li>
<li class="button" id="bottom-start" onclick="window.location='kontakt.html';">Kontakt</li>
<li class="button" id="bottom" onclick="window.location='hitta-hit.html';">Hitta hit</li>
<li class="button" id="bottom" onclick="window.location='bostaderna.html';">Verksamheterna</li>
</ul>
</div>

Preventing dropdown from hiding without JavaScript

An onClick and hover dropdown menu in pure CSS (no JavaScript) displays the items at first, but the menu doesn't stay open when I put my mouse over the dropdown items (but it does stay open onClick).
Here it is:
.acn-menu {
text-align: center;
background-color: rgba(0, 0, 0, 0.9);
}
.label_openclose {
display: none;
}
.menu-tabs {
height: 100%;
padding-left: 0;
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
}
#media (min-width: 320px) {
.menu-tabs {
position: absolute;
}
}
.menu-tabs .elem {
box-sizing: border-box;
padding: 0 20px;
float: left;
height: 100%;
line-height: 70px;
background-color: rgb(30, 30, 30);
color: white;
}
.menu-check {
display: none;
}
label {
margin-bottom: 0;
}
.label_openclose {
display: inline-block;
width: 60px;
min-height: 50px;
background-color: transparent;
cursor: pointer;
overflow:hidden;
display:block;
}
.menu-tabs .elem {
line-height: initial;
float: initial;
height: 0px;
cursor: pointer;
border-top: 0px solid #000;
overflow: hidden;
}
.menu-check:checked~.menu-tabs .elem {
height: 25px;
color: white;
border-top: 2px solid rgba(255, 255, 255, 0.2);
}
.label_openclose:hover~.menu-tabs .elem {
border-top: 2px solid rgba(255, 255, 255, 0.2);
height: 25px;
}
Here is a fiddle:
https://jsfiddle.net/Lwjvwcva/
You have to add a rule that tells the browser to show .menu-tabs while hovering on it, so I added this rule:
.label_openclose~.menu-tabs:hover .elem {
border-top: 2px solid rgba(255, 255, 255, 0.2);
height: 25px;
}
check the updated fiddle here.
hope this helps :)
In order for the submenu to remain open, the item where the submenu sits INSIDE needs to be the one selected on hover. In this case .acn-menu or .nav (I used .nav in my code). To make the hover submenu stay open, I removed and added a few lines in the css:
Removed:
.label_openclose:hover~.menu-tabs .elem {
border-top: 2px solid rgba(255, 255, 255, 0.2);
height: 25px;
}
Added:
.nav .menu-tabs {
display:none;
}
.nav:hover .menu-tabs {
display:block;
}
.menu-tabs .elem {
height:25px;
border-top: 2px solid rgba(255, 255, 255, 0.2);
}

how to enlarge a div on hover without moving other div

I'm looking to achieve a hover effect like this hover where the image enlarges but does not displace the surrounding divs. I have seen this done by assigning relative and absolute positioning and a z-index but that isn't working for me. Perhaps I assigned those values to the wrong classes. My code is below...any help is appreciated
I wasn't totally sure how to post the code here so...my site (and code problem) can be viewed here
It's my first time posting here. Thanks for the instruction. Here is the code...
HTML:
<div class="products-container">
<div class="products-container-inner">
<div class="item">
<div class="item">
<div class="item">
<div class="item">
CSS:
div.item {
height: 135px;
width: 150px;
margin: 10px;
display: inline-block;
float: left;
}
div.item:hover {
border: none; float: left;
height: 280px;
width: 280px;
background-color: #ffffff;
-moz-box-shadow: 0 0 5px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 0 5px rgba(0,0,0,0.5);
box-shadow: 0 0 5px rgba(0,0,0,0.5);
-webkit-transition: .2s ease;
-moz-transition: .2s ease;
-o-transition: .2s ease;
-ms-transition: .2s ease;
transition: .2s ease;
}
div.products-container-inner {
margin: auto;
width: 100%;
border: none;
padding: 10px;
overflow: hidden;
}
div.item .product-name {
text-align: center;
display: none;
}
div.item:hover .product-name {
text-align: center;
display: block;
}
div.item .price-box {
text-align: center;
display: none;
}
div.item:hover .price-box {
text-align: center;
display: block;
}
div.item .btn {
background-color: #EE432E;
background-image: -moz-linear-gradient(center top , #EE432E 0%, #C63929 50%, #B51700 50%, #891100 100%);
border: 1px solid #951100;
border-radius: 5px 5px 5px 5px;
box-shadow: 0 0 0 1px rgba(255, 115, 100, 0.4) inset, 0 1px 3px #333333;
color: #FFFFFF;
font: normal 16px/1 "helvetica neue",helvetica,arial,sans-serif;
padding: 3px 0;
float: left;
margin-left: 65px;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.8);
text-decoration: none;
width: 150px;
display: none;
}
div.item:hover .btn {
text-align: center;
display: block;
background-color: #F37873;
background-image: -moz-linear-gradient(center top , #F37873 0%, #DB504D 50%, #CB0500 50%, #A20601 100%);
cursor: pointer;
}
div.item:active .btn {
background-color: #D43C28;
background-image: -moz-linear-gradient(center top , #D43C28 0%, #AD3224 50%, #9C1500 50%, #700D00 100%);
box-shadow: 0 0 0 1px rgba(255, 115, 100, 0.4) inset;
}
In your example of what you want to achieve... There is two divs for the same pic.
One "regular" and one "hover" that only appears on hover.
This hidden one as a z-index of 2 and is shown over the first... Wich give that impression of a resising div. But it's not the case.
;)
===
EDIT:
ok Ryh, see this start I've done for you here...
Without jQuery, you will not have any "shiny effects" like fadein/fadeout...
But, it may be a choice to do it like this :
CSS:
div.item {width:200px;}
div.hover {display:none; position:relative; z-index:2; top:-200px; width:300px;}
// The top:-200px is to move the big image up... depends on the small pic height.
// And the width are in fonction of the pics width.
HTML:
<div class="item" id="img1" onmouseover="showbigger(this.id);">
<img src="something.jpg" style='width;200px; height:200px; border:1px solid black;'>
</div>
<div class="hover" id="img1big" onmouseout="shownormal(this.id);">
<img src="something-bigger.jpg" style='width;300px; height:300px; border:1px solid black;'>
</div>
<script>
function showbigger(ref){
document.getElementById(ref+'big').style.display='inline';
}
function shownormal(ref){
document.getElementById(ref).style.display='none';
}
</script>
You'll have to play a little with positioning and pic sizes.
And this may not a perfect solution... but it's a start if you want to do it with JavaScript.
I was able to achieve this without using two divs by "zooming in" on the element using
element:hover {
transform: scale(1.5);
}
https://www.w3schools.com/howto/howto_css_zoom_hover.asp
Html for a hyperlink:
Click Here
Css
a{text-decoration: none;
position: fixed;
color: #0000ff;
}
a:hover { text-decoration: initial;
color: #ff0000;
}
a:visited {color: #b200ff;}