I am trying to create a title that adjusts its size based on the screen width without breaking into multiple lines. I am currently using an SVG technique to achieve this effect.
Here is the code snippet:
<!DOCTYPE html>
<html lang="en">
<head>
<title>StackOverflowExample</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"
type="text/css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Muli" rel="stylesheet">
<script src="https://code.iconify.design/1/1.0.6/iconify.min.js"></script>
</head>
<style>
text {
font-family: 'Muli';
font-weight: 600;
fill: white;
}
svg {
width: 100%;
}
a {
color: white;
}
body {
background-image: linear-gradient(180deg, rgba(35, 50, 64, 0.91) 61.95%, rgba(0, 0, 0, 0.51) 94.56%),
/* height: 100vh; */
width: 100vw;
background-color: black;
background-position: center;
background-attachment: fixed;
background-size: cover;
background-repeat: no-repeat;
font-family: 'Muli';
color: #ffffff;
min-height: 100vh;
display: flex;
align-items: center;
}
</style>
<body class="text-center">
<div class="container">
<div class="row">
<div class="col-12">
<svg viewBox="0 0 167 20">
<text x="0" y="15">This is a Test Of This T</text>
</svg>
</div>
</div>
</div>
</body>
</html>
The title resizing works perfectly in Chrome, but it cuts off the last letter on iOS. See screenshots below:
iOS: https://i.sstatic.net/Q8QOo.png
Chrome: https://i.sstatic.net/JWbJr.png
Any suggestions on how to make it display correctly on both browsers and operating systems? The intended text is "This is a test of This T". Despite adjusting the viewbox parameters, I can't find a solution that caters to both platforms.