I have looked through a few other questions and answers but still can't get this working in Safari (v 5.1.7).
Here is my code - jsfiddle
.services {
width: 218px;
float: left;
margin-right: 29px;
}
.services img {
border: solid 8px #ccc;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.services a img:hover {
border: solid 8px #333;
-o-transition: all 1s ease 0s;
-ms-transition: all 1s ease 0s;
-moz-transition: all 1s ease 0s;
-webkit-transition: all 1s ease 0s;
transition: all 1s ease 0s;
}
The image is square 218px x 218px, so I'm guessin that has something to do with it, but I wanted it like that so it would look decent enough in older browsers that don't support border radius.
It's probably something simple, but I'm still stuck on this.
Thanks.
Al.
Answer from Sitepoint:
Hm, tricky. It works if you put the border on the instead:
Code:
.services {
width: 218px;
float: left;
margin-right: 29px;
}
.services img {
vertical-align: top;
}
.services img, .services a {
border-radius: 50%;
}
.services a {
border: 8px solid #ccc;
display: inline-block;
}
.services a:hover {
border: 8px solid #333;
-o-transition: all 1s ease 0s;
-ms-transition: all 1s ease 0s;
-moz-transition: all 1s ease 0s;
-webkit-transition: all 1s ease 0s;
transition: all 1s ease 0s;
}
You can just use border-radius now, without the vendor prefixes, as all browsers that are going to support it now.
Related
I am using a number of Pseudo elements throughout a website I am building. They all look great except in IE. I am testing it in IE 10 and 11 to start off with.
For some reason the positioning is always slightly off - in the example below, about 5 px for each element.
I have tried changing the display and positions, setting the origins, but nothing seems to work.
Any help would be appreciated.
.home .welcome-row h1 {
position: relative;
margin-bottom: 0;
}
.home .welcome-row h1:before {
background-image: url('/wp-content/uploads/2017/10/welcome-line-1.png');
-webkit-transform: translateY(-23px);
-moz-transform: translateY(-23px);
-o-transform: translateY(-23px);
transform: translateY(-23px);
background-size: 260px 13px;
background-repeat: no-repeat;
width: 260px;
height: 13px;
content:"";
position: absolute;
display: block;
}
.home .welcome-row h1:after {
background-image: url('wp-content/uploads/2017/10/welcome-line-2.png');
-webkit-transform: translateY(5px);
-moz-transform: translateY(5px);
-o-transform: translateY(5px);
transform: translateY(5px);
background-size: 260px 13px;
background-repeat: no-repeat;
width: 260px;
height: 13px;
content:"";
position: absolute;
display: block;
}
*EDIT - I have added any additional theme styles that are applied incase they have any relevance.
*:after,
*:before {
box-sizing:border-box
}
:-webkit-any(article,aside,nav,section) h1 {
-webkit-margin-before: 0.83em;
-webkit-margin-after: 0.83em;
}
user agent stylesheet
h1 {
-webkit-margin-before: 0.67em;
-webkit-margin-after: 0.67em;
-webkit-margin-start: 0px;
-webkit-margin-end: 0px;
}
h1 {
margin: 0;
padding: 0;
}
I am a novice in LESS CSS, but I have spent lot of time learning the CSS. Currently am migrating my CSS code to a LESS for learn and improve myself. I stumbled upon this when am doing the migration process,
Existing CSS Code
#sidebar {
-webkit-transition: background 1.2s ease, padding 1.8s linear;
background: #3c3c3c;
}
#sidebar .actionMenuList {
margin-bottom: 20%;
}
#sidebar .actionMenuList .topNavMenuList,
#sidebar .navigationMenuList .topNavMenuList {
-webkit-transition: background 0.3s ease-in-out;
border-bottom: .1em solid #FDF7F8;
}
Writing this LESS Code
#sidebar {
-webkit-transition: background 1.2s ease, padding 1.8s linear;
background: #3c3c3c;
.actionMenuList {
margin-bottom: 20%;
.topNavMenuList {
-webkit-transition: background .3s ease-in-out;
border-bottom: .1em solid #FDF7F8;
}
}
}
But am getting stuck in one place, how do I write the css prop for the navigationMenuList class selectors using the above hierarchy. Or do I need to fallback on the usual way of CSS for this
#sidebar .actionMenuList .topNavMenuList,
#sidebar .navigationMenuList .topNavMenuList {
You just do
#sidebar {
.navigationMenuList .topNavMenuList { }
}
all together
#sidebar {
.actionMenuList {
.topNavMenuList { ... }
}
.navigationMenuList {
.topNavMenuList { .... }
}
}
OR
assuming the rules are the same for both
#sidebar {
.actionMenuList,
.navigationMenuList {
.topNavMenuList {
-webkit-transition: background 0.3s ease-in-out;
border-bottom: .1em solid #FDF7F8;
}
}
}
you can even do
#sidebar {
.actionMenuList .topNavMenuList,
.navigationMenuList .topNavMenuList {
-webkit-transition: background 0.3s ease-in-out;
border-bottom: .1em solid #FDF7F8;
}
}
On a side note, if you ever get stuck at converting and need to make it work. Just leave the css in the less file and it will work like normal.
This works for me, and does what I expected.
#sidebar {
-webkit-transition: background 1.2s ease, padding 1.8s linear;
background: #3c3c3c;
.actionMenuList { margin-bottom: 20%; }
.actionMenuList .menuItem, .navigationMenuList .menuItem {
-webkit-transition: background .3s ease-in-out;
border-bottom: .1em solid #FDF7F8;
}
}
I am currently trying to make my CSS3 animations work across most browsers but at the minute I am only getting it to work on web kit browsers.
Here is my code:
h1 {
font-family: 'BebasRegular', sans-serif;
font-size: 150px;
padding-bottom: 100px;
padding-top: 50px;
background: #E9AB17 -webkit-gradient(linear,left top, right top, from(#e8a917), to(#f4b011), color-stop(0.5, #fff)) 0 0 no-repeat ;
-webkit-background-size: 75px 200px;
color: rgba(255, 255, 255, 0.1);
-webkit-background-clip: text;
-webkit-animation-name: shine;
-webkit-animation-duration: 5s;
-webkit-animation-iteration-count: infinite;
text-align:center;
}
I have since added to code to and I am still having problems.
h1 {
font-family: 'BebasRegular', sans-serif;
font-size: 150px;
padding-bottom: 100px;
padding-top: 50px;
background: #E9AB17 -webkit-gradient(linear,left top, right top, from(#e8a917), to(#f4b011), color-stop(0.5, #fff)) 0 0 no-repeat ;
background: #E9AB17 -moz-gradient(linear,left top, right top, from(#e8a917), to(#f4b011), color-stop(0.5, #fff)) 0 0 no-repeat ;
background: #E9AB17 -o-gradient(linear,left top, right top, from(#e8a917), to(#f4b011), color-stop(0.5, #fff)) 0 0 no-repeat ;
background: #E9AB17 linear-gradient(linear,left top, right top, from(#e8a917), to(#f4b011), color-stop(0.5, #fff)) 0 0 no-repeat ;
-webkit-background-size: 75px 200px;
background-size: 75px 200px; /* Chrome, Firefox 4+, IE 9+, Opera, Safari 5+ */
color: rgba(255, 255, 255, 0.1);
-webkit-background-clip: text;
background-clip: text;
-webkit-animation-name: shine;
-moz-animation-name: shine;
-o-animation-name: shine;
animation-name: shine;
-webkit-animation-duration: 5s;
-moz-animation-duration: 5s;
-o-animation-duration: 5s;
animation-duration: 5s;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
-o-animation-iteration-count: infinite;
animation-iteration-count: infinite;
text-align:center;
}
#-webkit-keyframes shine
{
0%
{
background-position: bottom left;
}
28%,100%
{
background-position: top right;
}
}
#-moz-keyframes shine {
0%
{
background-position: bottom left;
}
28%,100%
{
background-position: top right;
}
}#-o-keyframes shine {
0%
{
background-position: bottom left;
}
28%,100%
{
background-position: top right;
}
}#keyframes shine {
0%
{
background-position: bottom left;
}
28%,100%
{
background-position: top right;
}
}
Colorzilla
I guess thats probably what you need for the gradients.
as for animations
here
For more information regarding CSS compatibility see
here
I have implemented box-shadow effect in an div using CSS3 Animation... The code works fine in firefox and chrome but i dont know why my code is not working in Safari and Opera...
Safari Version i am using 5.1.7...
and Opera Version 12.12...
JsFiddle Link
My Code:
#-moz-keyframes glowz {
0% { -moz-box-shadow:0px 0px 10px 10px rgba(64,142,0,1); }
33% { -moz-box-shadow:0px 0px 7px 7px rgba(64,142,0,1); }
66% { -moz-box-shadow:0px 0px 2px 2px rgba(64,142,0,1); }
100% { -moz-box-shadow:0px 0px 9px 9px rgba(64,142,0,1); }
}
#-webkit-keyframes glowz {
0% { -webkit-box-shadow:0px 0px 10px 10px rgba(64,142,0,1); }
33% { -webkit-box-shadow:0px 0px 7px 7px rgba(64,142,0,1); }
66% { -webkit-box-shadow:0px 0px 2px 2px rgba(64,142,0,1); }
100% { -webkit-box-shadow:0px 0px 9px 9px rgba(64,142,0,1); }
}
#-o-keyframes glowz {
0% { -o-box-shadow:0px 0px 10px 10px rgba(64,142,0,1); }
33% { -o-box-shadow:0px 0px 7px 7px rgba(64,142,0,1); }
66% { -o-box-shadow:0px 0px 2px 2px rgba(64,142,0,1); }
100% { -o-box-shadow:0px 0px 9px 9px rgba(64,142,0,1); }
}
#keyframes glowz {
0% { box-shadow:0px 0px 10px 10px rgba(64,142,0,1); }
33% { box-shadow:0px 0px 7px 7px rgba(64,142,0,1); }
66% { box-shadow:0px 0px 2px 2px rgba(64,142,0,1); }
100% { box-shadow:0px 0px 9px 9px rgba(64,142,0,1); }
}
.blinker {
background-color: #FF0000;
display: block;
height: 27px;
position: absolute;
width: 27px;
left:50%; top:50%;
border-radius: 5em; -webkit-border-radius: 5em; -moz-border-radius: 5em; -o-border-radius: 5em;
-ms-animation: 5s ease-in-out 0s alternate none infinite glowz;
-webkit-animation: 5s ease-in-out 0s alternate none infinite glowz;
-moz-animation: 5s ease-in-out 0s alternate none infinite glowz;
-o-animation: 5s ease-in-out 0s alternate none infinite glowz;
animation: 5s ease-in-out 0s alternate none infinite glowz;
}
Is css3 animation is buggy in safari and opera ??
Tweak your CSS little bit and it will work.
Replace Following code:
-ms-animation: 5s ease-in-out 0s alternate none infinite glowz;
-webkit-animation: 5s ease-in-out 0s alternate none infinite glowz;
-moz-animation: 5s ease-in-out 0s alternate none infinite glowz;
-o-animation: 5s ease-in-out 0s alternate none infinite glowz;
animation: 5s ease-in-out 0s alternate none infinite glowz;
With following Code:
-webkit-animation-name: glowz;
-webkit-animation-duration: 5s;
-webkit-animation-timing-function: ease-in-out;
-webkit-animation-iteration-count: infinite;
-webkit-animation-direction: alternate;
-webkit-animation-delay: 0;
-webkit-animation-fill-mode: none;
-moz-animation-name: glowz;
-moz-animation-duration: 5s;
-moz-animation-timing-function: ease-in-out;
-moz-animation-iteration-count: infinite;
-moz-animation-direction: alternate;
-moz-animation-delay: 0;
-moz-animation-fill-mode: none;
-o-animation-name: glowz;
-o-animation-duration: 5s;
-o-animation-timing-function: ease-in-out;
-o-animation-iteration-count: infinite;
-o-animation-direction: alternate;
-o-animation-delay: 0;
-o-animation-fill-mode: none;
animation-name: glowz;
animation-duration: 5s;
animation-timing-function: ease-in-out;
animation-iteration-count: infinite;
animation-direction: alternate;
animation-delay: 0;
animation-fill-mode: none;
DEMO
this is my style.less code:
.transition {
-ms-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
.shadow {
padding: 10px 10px 10px 10px;
margin: 10px 10px 10px 10px;
-moz-box-shadow: 0px 0px 10px #808080;
-o-box-shadow: 0px 0px 10px #808080;
-webkit-box-shadow: 0px 0px 10px #808080;
box-shadow: 0px 0px 10px #808080;
}
.shadow:hover {
-moz-box-shadow: 0px 0px 10px #a5a5a5;
-o-box-shadow: 0px 0px 10px #a5a5a5;
-webkit-box-shadow: 0px 0px 10px #a5a5a5;
box-shadow: 0px 0px 10px #a5a5a5;
}
.radius {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
}
#t1 {
.shadow;
.transition;
.radius;
}
but when I hover #t1 the shadow doesn't change. I want to know why it doesn't work and expect add #t1:hover and inherit the style is there any other way?
You need to change the .hover class to include the :hover state as part of the class definition:
.hover {
...styles...
&:hover {
...hover state styles...
}
}
.someOtherClass {
.hover;
}
Example
In order to have the :hover styles generated correctly you need to connect .shadow and .shadow:hover via the & operator so they belong together:
.shadow {
/*normal styles*/
&:hover{
/* hover styles */
}
}
The rest can stay the same, because
#t1{
.shadow;
}
will now automatically generate both, the normal and the hover rules.
You can try it out here: Online-Less-Converter
Every additional block you add to .shadow via the & operator will automatically be applied to #t1 as well, so if you add another:
.shadow{
&:hover{}
&.foo{
/* another set of rules*/
}
}
#t1{
.shadow; /* this will now generate 3 ruleblocks for #t1*/
}
the .foo ruleblock will be generated for #t1 as well:
#t1{...}
#t1:hover{...}
#t1.foo{/* another set of rules*/}