CSS Transition

I am currently coding The Summit exercise and it was noted I could use the Transition property to make a button transition. I tried to modify the text size of a button on hovering however I am getting some weird visual transitions and I was wondering if anyone can shed some light on what the issue is?

When I hover over the button:

When I stop hovering over the button:

My CSS code:

a{
  text-decoration: underline;
}

a:hover{
  color: orange;
}

a:active{
  text-decoration: none;
  color: orange;
}

.nav-link{
  text-decoration: none;
}
.nav-link:hover{
  color: red;
  text-decoration: underline;
  font-weight: bold;
}

.btn{
  border: 1px solid black;
  border-radius: 10px;
  padding: 20px;
  font-size: 14px;
  background-color: #2176FFAA;
  color: #fff;
  text-transform: uppercase;
  cursor: pointer;
  transition: font-size 0.3s 0.3s;
}

.btn:hover{
  font-size: 20px;
}

The starting CSS code (not modified by me):

body{
  background-color: #ffffff;
  margin: 0px;
  padding:0px;
}
.navigation{
  box-sizing: border-box;
  background-color: #ffffff;
  border-bottom: 1px solid #dddddd;
  left: 0px;
  overflow-y: auto;
  padding:30px;
  position: fixed;
  text-align: center;
  top: 0px;
  width: 100%;
  z-index: 999;
}
ul{
  margin: 0px;
  padding: 0px;
}
.navigation a{
  color: #736B92;
  display: inline-block;
  font-family: 'Raleway', sans-serif;
  font-size: 16px;
  font-weight: 300;
  letter-spacing: 2px;
  padding: 10px 40px;
  text-transform: uppercase;
}
a.logo{
  color: #2176FF;
  font-family: 'Amatic SC',sans-serif;
  font-size: 34px;
  padding: 0px 60px;
  text-align: center;
  text-transform: uppercase;
}
.banner{
  background-image: url("https://images.unsplash.com/photo-1418290232843-5d7a0bd93f7d?dpr=1&auto=format&crop=entropy&fit=crop&w=1500&h=1001&q=80&cs=tinysrgb");
  background-position: center top;
  background-size: cover;
  border-bottom: 1px solid #dddddd;
  height: 700px;
  position: relative;
  text-align: center;
  top: 100px;
  width: 100%;
}
.banner-text{
  position: relative;
  top: 200px;
}
h1{
  color: #ffffff;
  font-family: 'Raleway',sans-serif;
  font-size: 60px;
  font-weight: 100;
  letter-spacing: 2px;
  margin: 0px;
  text-align: center;
  text-transform: uppercase;
}
h2{
  color: #2176FF;
  font-family: 'Amatic SC',sans-serif;
  font-size: 30px;
  margin: 0px;
  text-align: center;
  text-transform: uppercase;
}
.banner h2{
  font-size: 120px;
  margin: -40px 0px 80px 0px;
}
.content{
  background-image: url('https://content.codecademy.com/courses/learn-links-and-buttons/project/mountain1.jpg');
  background-position: center top;
  background-size: cover;
  border-bottom: 1px solid #eeeeee;
  margin: 0 auto;
  overflow-y: auto;
  padding: 80px 0px;
  position: relative;
  text-align: center;
}
p{
  color: #000000;
  font-family: 'Raleway',sans-serif;
  font-size: 18px;
  line-height: 42px;
  text-align: left;
}
.description{
  display: inline-block;
  width: 70%;
}
.activities-panel{
  margin-bottom: 40px;
  padding: 80px 0px;
  text-align: center;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: center;
}
.activities-panel h2 {
  width: 100%;
}
.activity{
  background-color: #2176FF;
  box-sizing: border-box;
  width: 240px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: 'Amatic SC',sans-serif;
  font-size: 30px;
  text-align: center;
  text-transform: uppercase;
  margin: 5px;
}
.footer{
  background-color: #2176FF;
  padding: 30px;
  text-align: center;
}
.footer h2{
  color: #ffffff;
  font-family: 'Raleway',sans-serif;
  font-size: 14px;
  font-weight: 100;
  letter-spacing: 2px;
}

a {
  cursor: default;
  text-decoration-line: none;
}

Thanks in advance!

Hi,
bugs like those in the screenshot are most likely caused by hardware like the graphic card. Since browsers behave differently, it is possible that you experience a a different behaviour in another browser. This is not something that is caused by css.

Ah yes you are correct! I was using safari to access codecademy when the issues occured, I have just tried using Chrome and this is no longer an issue! This is interesting though, is there a reason Safari is causing this problem and is there anything I can do to stop this happening. I wonder if anyone else has had similar problems using safari with transitions?

I still think it’s a combination of how the browser renders the page and your hardware. Generally, I don’t have difficulties with Safari and css transitions. But I have issues in Adobe Creative Suite with my Macbook with M1 chip that resemble those in your screenshot. Maybe you have very old hardware, a buggy graphic card or a Mac with M1 chip?

I am using an M1 macbook air yeh, so perhaps that is the reason!

1 Like