Reputation: 173
I'm trying to make a portfolio website. The website is done but ofc its results differently in different browsers. In Chrome everything works perfectly but in Safari things get weird. My hero text box and hero image icon are centered to the middle in chrome and to the right in safari without changing code. I posted some code and images below.
.hero-text-box {
position: absolute;
width: 1140px;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.hero-icon-box {
position: absolute;
width: 1140px;
top: 92%;
left: 50%;
transform: translate(-50%, -50%);
}
The first image is chrome the second one safari.
Upvotes: 1
Views: 681
Reputation: 2900
use -webkit-
prefix for transform
.hero-text-box {
position: absolute;
width: 1140px;
left: 50%;
top: 50%;
-webkittransform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.hero-icon-box {
position: absolute;
width: 1140px;
top: 92%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
Upvotes: 4