No matter what I do, I cannot seem to get the border radius to work on IOS devices. I have tried inline-styling, webkit, and so forth.
Here is a sample of my html and css
.border-radius {
border-radius: 7px;
-webkit-border-radius: 7px;
-moz-border-radius: 7px;
}
.border-radius2 {
border-radius: 0px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
}
.nav-menu {
background-color: rgba(178, 214, 222);
display: flex;
gap: 1.25rem;
padding: 1rem 0;
}
.btn {
padding: 0.35rem 1.1rem;
}
.btn-effect {
border: 1px rgba(255,255,255,0) solid;
box-shadow: inset 0 0 20px rgba(255, 255, 255, 0);
outline: 1px solid;
outline-color: rgba(255, 255, 255, .5);
outline-offset: 0px;
text-shadow: none;
transition: 1.25s cubic-bezier(0.19, 1, 0.22, 1);
}
.btn-effect:hover {
border: 1px rgba(255,255,255,.25) solid;
box-shadow: inset 0 0 15px rgba(221, 176, 213, 0.75), 0 0 15px rgba(221, 176, 213, 0.4);
outline-color: rgba(255, 255, 255, 0);
outline-offset: 12px;
}
.btn-effect:active {
box-shadow: inset 0 0 15px rgb(221, 145, 206), 0 0 15px rgba(221, 176, 213, 0.4);
outline-color: rgba(255, 255, 255, .25);
outline-offset: 0px;
}
li {
list-style: none;
}
<ul class="nav-menu" id="nav-menu-one">
<li class="nav-item btn btn-effect border-radius">Home</li>
<li class="nav-item btn btn-effect border-radius">Menu</li>
<li class="nav-item btn btn-effect border-radius2">Pics</li>
<li class="nav-item btn btn-effect border-radius2">Events</li>
</ul>
The first two links are the desired outcome. However, on Safari, all the links appear as though they are using the example "border-radius2" class that I set up; It is as though there is no border-radius being applied
As you can see on the published site (still in development) (http://dessertbargilbert.com), it works perfectly fine on desktop in Chrome, but when testing on iPad, but buttons are squared off. Why would this be? The end goal is to get all class with "border-radius" to have the border applied correctly.
Any help is greatly appreciated.
I just played around with devtools in Safari (seems like it breaks on Safari desktop, not just iOS devices), and it seems like the outline property doesn't play nicely with border-radius.
It worked for me when I removed the outline and just kept the border and border-radius:
.btn-effect {
/* Changing `border` color to a non-zero opacity */
border: 1px rgba(255,255,255,0.5) solid;
box-shadow: inset 0 0 20px rgba(255, 255, 255, 0);
/* Removing outline styles */
/* outline: 1px solid; */
/* outline-color: rgba(255, 255, 255, .5); */
/* outline-offset: 0px; */
text-shadow: none;
transition: 1.25s cubic-bezier(0.19, 1, 0.22, 1);
}
Related
I've never asked a css question before so apologies in advance.
This is what my nav bar looks like currently
full sized image here
Two things I really want to achieve:
round of the tabs just above and below the current tab
(in this picture it would be Suggestions and About Us)
shadow the nav bar on the right side except the current tab
(I'm using jinja2 btw. Cannot hard code the corners since the current tab is not fixed)
I have no idea about 1. but I tried 2. and this is the unsatisfied result:
would like to get rid of the abrupt corners
This is my current stylesheet
:root {
/* colour palette */
--cream : hsl(40, 100%, 96%);
--cream-light:hsl(40, 100%, 98%);
--coffee: hsl(40, 14%, 62%);
--purple: hsl(258, 14%, 62%);
--dark : hsl(109, 7%, 33%);
--green : hsl(128, 30%, 42%);
--green2: hsl(140, 15%, 55%);
--green2-dark: hsl(140, 11%, 36%);
/* */
--shadow-in: inset 1px .15rem .3rem -.1rem rgba(50, 50, 93, 0.25), inset 1px .1rem .2rem -.1rem rgba(0, 0, 0, 0.3), inset -1px -1px .3rem -.1rem rgba(50, 50, 93, 0.25), inset -1px -1px .2rem -.1rem rgba(0, 0, 0, 0.3);
--shadow-nav: .3rem 0 .6rem -.2rem rgba(50, 50, 93, 0.25), .2rem 0 .4rem -.2rem rgba(0, 0, 0, 0.3);
--shadow-current: inset .3rem .3rem .6rem -.2rem rgba(50, 50, 93, 0.25), inset .2rem .2rem .4rem -.2rem rgba(0, 0, 0, 0.3);
--shadow-hover: inset 1px .3rem .6rem -.2rem rgba(50, 50, 93, 0.25), inset 1px .2rem .4rem -.2rem rgba(0, 0, 0, 0.3), inset -1px -1px .6rem -.2rem rgba(50, 50, 93, 0.25), inset -1px -1px .4rem -.2rem rgba(0, 0, 0, 0.3);
/* themes */
--nav-bg : var(--green2-dark);
--nav-text : white;
--nav-hover: hsl(140, 11%, 27%);
--main : var(--cream );
--text : var(--dark );
--highlight: var(--green);
--card : var(--cream-light);
}
html, body {
margin: 0;
font-size: 1.5vw;
background: var(--nav-bg);
transition: all .5s ease;
}
a {
color: var(--text);
text-decoration: none;
}
a:hover {
color: var(--green);
}
nav {
position: fixed;
top: 0;
left: 0;
width: 18%;
height: 100vh;
/*box-shadow: var(--shadow-nav);*/
/*box-shadow: .3rem 0 .6rem rgba(50, 93, 50, 0.25), .2rem 0 .4rem rgba(0, 0, 0, 0.3);*/
background: var(--nav-bg);
}
nav h2 {
margin: 0;
padding: 10%;
padding-right: 0 !important;
height: 1.8rem;
background: var(--nav-bg);
color: var(--nav-text);
transition: margin .5s, padding .5s, border .5s, background .5s, color .3s;
}
/*nav div.current {
width: 100%;
padding-right: .9rem;
background: linear-gradient(90deg, hsl(140, 11%, 36%) 50%, hsl(40, 100%, 96%) 50%);
}
nav div.current:hover {
padding-right: 0;
}*/
nav h2.current {
margin-left: 5%;
padding-left: 5%;
border-radius: .5rem 0 0 .5rem;
box-shadow: var(--shadow-current);
background: var(--main);
color: var(--text);
}
nav h2:hover {
margin: 0;
padding: 10%;
padding-left: 15%;
border-radius: 0;
box-shadow: var(--shadow-hover);
background: var(--nav-hover);
color: var(--nav-text);
}
main {
padding-left: 22.5%;
padding-right: 7.5%;
min-height: 100vh;
background: var(--main);
color: var(--text);
display: flex;
flex-direction: column;
}
main h1 {
color: var(--green2);
}
footer {
margin-top: auto;
margin-bottom: .35rem;
padding: .25rem;
padding-right: 2.5rem;
border-radius: .25rem;
font: .5rem sans-serif;
text-align: right;
background: hsl(40, 39%, 90%);
box-shadow: var(--shadow-in);
}
and this is layout.html
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Library</title>
<meta charset='UTF-8'>
</head>
<body>
<nav>
{% include 'navigation.html' %}
</nav>
<main>
{% block main %} {% endblock %}
<footer>Copyright 2021 mightbesimon | github.com/mightbesimon</footer>
</main>
</body>
</html>
and this is navigation.html
{% for url, name in (('/' , 'Home' ),
('/register' , 'Register' ),
('/login' , 'Login' ),
('/suggestions', 'Suggestions' ),
('/catalogue' , 'Our Catalogue'),
('/aboutus' , 'About Us' ),
('/contact' , 'Contact' ),
) %}
<a href="{{ url }}">
<!-- <div {% if url_for(request.endpoint, **request.view_args)==url %} class="current" {% endif %}> -->
<h2 {% if url_for(request.endpoint, **request.view_args)==url %} class="current" {% endif %}>
{{ name }}
</h2>
<!-- </div> -->
</a>
{% endfor %}
You could give a try to
drop-shadow() (but it will do on any translucide edges => text too unfortunately) to draw the shadow via filter .
box-shadow from .current to paint the nav background
overflow:hidden on nav to avoid shadow to bleed on main
position: relative for h2 to remain on top of the shadow & static for .current
here is the idea of possible update
:root {
/* colour palette */
--cream: hsl(40, 100%, 96%);
--cream-light: hsl(40, 100%, 98%);
--coffee: hsl(40, 14%, 62%);
--purple: hsl(258, 14%, 62%);
--dark: hsl(109, 7%, 33%);
--green: hsl(128, 30%, 42%);
--green2: hsl(140, 15%, 55%);
--green2-dark: hsl(140, 11%, 36%);
/* */
--shadow-in: inset 1px 0.15rem 0.3rem -0.1rem rgba(50, 50, 93, 0.25),
inset 1px 0.1rem 0.2rem -0.1rem rgba(0, 0, 0, 0.3),
inset -1px -1px 0.3rem -0.1rem rgba(50, 50, 93, 0.25),
inset -1px -1px 0.2rem -0.1rem rgba(0, 0, 0, 0.3);
--shadow-nav: 0.3rem 0 0.6rem -0.2rem rgba(50, 50, 93, 0.25),
0.2rem 0 0.4rem -0.2rem rgba(0, 0, 0, 0.3);
--shadow-current: inset 0.3rem 0.3rem 0.6rem -0.2rem rgba(50, 50, 93, 0.25),
inset 0.2rem 0.2rem 0.4rem -0.2rem rgba(0, 0, 0, 0.3);
--shadow-hover: inset 1px 0.3rem 0.6rem -0.2rem rgba(50, 50, 93, 0.25),
inset 1px 0.2rem 0.4rem -0.2rem rgba(0, 0, 0, 0.3),
inset -1px -1px 0.6rem -0.2rem rgba(50, 50, 93, 0.25),
inset -1px -1px 0.4rem -0.2rem rgba(0, 0, 0, 0.3);
/* themes */
--nav-bg: var(--green2-dark);
--nav-text: white;
--nav-hover: hsl(140, 11%, 27%);
--main: var(--cream);
--text: var(--dark);
--highlight: var(--green);
--card: var(--cream-light);
}
html,
body {
margin: 0;
font-size: 1.5vw;
background: var(--nav-bg);
transition: all 0.5s ease;
}
a {
color: var(--text);
text-decoration: none;
}
a:hover {
color: var(--green);
}
nav {
position: fixed;
top: -1rem;
bottom: -1rem;
left: 0;
width: 18%;
padding: 1rem 0;
min-height:100vh;
overflow: hidden;
filter: drop-shadow(0.3rem 0.3rem 0.6rem);
}
nav h2 {
margin: 0;
padding: 10%;
padding-right: 0 !important;
height: 1.8rem;
transition: margin 0.5s, padding 0.5s, border 0.5s, background 0.5s,
color 0.3s;
position: relative;
color: var(--nav-text);
}
nav h2.current:hover {
box-shadow: var(--shadow-hover), 0 0 0 100vw var(--nav-bg);
}
nav h2.current {
margin-left: 5%;
padding-left: 5%;
border-radius: 0.5rem 0 0 0.5rem;
box-shadow: 0 0 0 100vmax var(--nav-bg);
color: var(--text);
position: static;
}
nav h2:hover {
margin: 0;
padding: 10%;
padding-left: 15%;
border-radius: 0;
box-shadow: var(--shadow-hover);
background: var(--nav-hover);
color: var(--nav-text);
}
main {
padding-left: 22.5%;
padding-right: 7.5%;
min-height: 100vh;
background: var(--main);
color: var(--text);
display: flex;
flex-direction: column;
}
main h1 {
color: var(--green2);
}
footer {
margin-top: auto;
margin-bottom: 0.35rem;
padding: 0.25rem;
padding-right: 2.5rem;
border-radius: 0.25rem;
font: 0.5rem sans-serif;
text-align: right;
background: hsl(40, 39%, 90%);
box-shadow: var(--shadow-in);
}
https://developer.mozilla.org/en-US/docs/Web/CSS/filter-function/drop-shadow()
Note: This function is somewhat similar to the box-shadow property. The box-shadow property creates a rectangular shadow behind an element's entire box, while the drop-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself.
Let's say i have a button class
.mat-cancel-color {
width: 160px;
border: 1px solid #dddddd;
color: #dddddd;
background-color: white;
border-radius: 25px;
}
and whenever i click something(not the 'mat-cancel-color' button) i want this class to gain a glow effect which would fade away over .4s.
should i create a new class and then give that class the box-shadow(glow) property, then below transition-duration property and then the the box-shadow(no glow) property again? as such:
click-class {
-webkit-box-shadow: 0px 0px 15px 10px rgba(255,255,0,1);
-moz-box-shadow: 0px 0px 15px 10px rgba(255,255,0,1);
box-shadow: 0px 0px 15px 10px rgba(255,255,0,1);
transition-duration: .4s;
-webkit-box-shadow: 0px 0px 0px 0px rgba(255,255,0,1);
-moz-box-shadow: 0px 0px 0px 0px rgba(255,255,0,1);
box-shadow: 0px 0px 0px 0px rgba(255,255,0,1);
}
or does transition-duration only work when switching classes or does it also work when switching properties inside a class? if it as such, how should i go about it?
EDIT: mistook transition-delay with transition-duration.
What you are looking for is a CSS animation. Mainly because you don't want the default state with the glow, that's why transition won't work here.
.mat-cancel-color {
width: 160px;
border: 1px solid #dddddd;
color: #dddddd;
background-color: white;
border-radius: 25px;
}
.mat-cancel-color:hover {
animation-name: glow;
animation-duration: .4s;
}
.mat-cancel-color-trans {
width: 160px;
border: 1px solid #dddddd;
color: #dddddd;
background-color: white;
border-radius: 25px;
transition: all .4s ease;
box-shadow: 0px 0px 15px 10px rgba(255, 255, 0, 0);
}
.mat-cancel-color-trans:hover {
box-shadow: 0px 0px 0px 0px rgba(255, 255, 0, 1);
}
/* Standard syntax */
#keyframes glow {
0% {
box-shadow: 0px 0px 15px 10px rgba(255, 255, 0, 1);
}
100% {
box-shadow: 0px 0px 0px 0px rgba(255, 255, 0, 1);
}
}
<button class="mat-cancel-color">Button</button>
<button class="mat-cancel-color-trans">Button</button>
You could use some psudo classes like this:
:active:not(*element/class*) {...}
and then put the glow animation that you want within the brackets. :active is a psudo class that is only applied when the element named is clicked. :not() excludes the class listed in the parentheses. As long as you have the glow animation working fine, then this should work.
This is a snippet of my test code:
a:active:not(.mat-cancel-color) {...}
I have a program in html that has a progress element. It turns blue in firefox, but refuses to work in chrome, and it turns green, which I don't want. my code
progress {
color: #0063a6;
font-size: .6em;
line-height: 1.5em;
text-indent: .5em;
width: 30em;
height: 3em;
border: 1px solid #0063a6;
background: #fff;
}
<progress value ="50" max ="100"></progress>
You need to do two things. First reset the style of the progressbar to it's default values and then target the appearance with a browser specific pseudo class like so:
progress {
-webkit-appearance: none;
appearance: none;
}
progress::-webkit-progress-bar {
background-color: #eee;
border-radius: 2px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25) inset;
}
styling the bar itself is done using background-image:
progress[value]::-webkit-progress-value {
background-image:
-webkit-linear-gradient(-45deg,
transparent 33%, rgba(0, 0, 0, .1) 33%,
rgba(0,0, 0, .1) 66%, transparent 66%),
-webkit-linear-gradient(top,
rgba(255, 255, 255, .25),
rgba(0, 0, 0, .25)),
-webkit-linear-gradient(left, #09c, #f44);
border-radius: 2px;
background-size: 35px 20px, 100% 100%, 100% 100%;
}
Read the full article here:
https://css-tricks.com/html5-progress-element/
With Chrome 42 and OSX 10.10.3, the scrollbar of the iframe contained in this page (https://uala-frontend.herokuapp.com/venues/5/) doesn't scroll.
Despite, the content inside the iframe scroll. Why?
Instead with Firefox, Safari or Chrome for mobile it works perfectly.
changing the color of the scrollbar, it works...
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: #FFF;
-webkit-box-shadow: inset 1px 1px 2px #E0E0E0;
border: 1px solid #D8D8D8;
}
::-webkit-scrollbar-thumb {
background: #D92428;
-webkit-box-shadow: inset 1px 1px 2px rgba(155, 155, 155, 0.4);
}
::-webkit-scrollbar-thumb:hover {
-webkit-box-shadow: inset 1px 1px 10px rgba(0, 0, 0, 0.3);
}
::-webkit-scrollbar-thumb:active {
background: #888;
-webkit-box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.3);
}
I am trying to make this button using CSS3:
But my button looks like this right now:
The CSS3 Gradient effect somehow removes the blue color, why does it do that and how can I fix it.
Here is a jsFiddle example: http://jsfiddle.net/fjYWZ/
HTML code:
<a class="button large facebook radius nice" href="#">Logga in med facebook</a>
CSS code:
.button{
-moz-transition-duration: 0.1s;
-moz-transition-property: opacity;
-moz-transition-timing-function: ease-in;
background-color: #999999;
border: 1px solid #999999;
color: #FFFFFF;
cursor: pointer;
display: inline-block;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 1.3rem;
font-weight: bold;
line-height: 34px;
margin: 0;
outline: medium none;
padding: 0 34px;
position: relative;
text-align: center;
text-decoration: none;
}
.large {
font-size: 18px;
line-height: 48px;
padding: 0 40px;
width: auto;
}
.facebook {
background-color: #3B5998;
border-color: #3B5998;
color: #FFFFFF;
}
.button.radius {
border-radius: 7px 7px 7px 7px;
}
.full-width {
padding-left: 0 !important;
padding-right: 0 !important;
text-align: center;
width: 100%;
}
.nice {
background: -moz-linear-gradient(center top , rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0)) repeat scroll 0 0%, none repeat scroll 0 0 #999999;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.3);
}
Just add this property in your .button class
.button{
/*Your existing styling*/
background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.4)), to(rgba(255, 255, 255, 0)));
}
Try this updated fiddle
EDIT I have updated the code to support multiple colors here you can find two buttons with different colors. I have added two classes as .red & .blue. Please refer new fiddle
.blue{
background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 255, 255, 0.4)), to(rgba(255, 255, 255, 0)));
background: -moz-linear-gradient(center top , rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0)) repeat scroll 0 0%, none repeat scroll 0 0 #999999;
}
.red{
background: -webkit-gradient(linear, left top, left bottom, from(rgba(255, 0, 0, 0.4)), to(rgba(255, 0, 0, 0)));
background: -moz-linear-gradient(center top , rgba(255, 0, 0, 0.4) 0%, rgba(255, 0, 0, 0)) repeat scroll 0 0%, none repeat scroll 0 0 #999999;
}
Note: remove these properties from the body class. Also add as much color classes you want and add this class as second param in your style tag as
<a class="button blue large facebook radius nice" href="#">Logga in med facebook</a>
here class="button blue large facebook radius nice" use second class as new color class.
Your -moz-linear-gradient resets the background to #999999... change that to #3B5998 and it works beautifully.
Keep in mind that the -moz prefixes mean this will only work in Firefox.