Pure CSS FitText

Size
3,357 Kb
Views
44,528

How do I make an pure css fittext?

Inflating web type, but without the JS. Basically, fittext --> http://fittextjs.com/ without any javascript, based on vw font-sizes, so instead of being relative to the parent element, it's relative to the browser window. Try resizing your browser.. What is a pure css fittext? How do you make a pure css fittext? This script and codes were developed by Hans Engebretsen on 09 August 2022, Tuesday.

Pure CSS FitText Previews

Pure CSS FitText - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Pure CSS FitText</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import "https://fonts.googleapis.com/css?family=Baloo+Paaji";
.fittext { font-size: 8.8vw; line-height: 1; text-align: center;
}
.fittext2 { font-size: 5vw; margin-top: 0;
}
body { background-color: #c44032; color: #f4f1de; font-family: 'Baloo Paaji', 'Impact';
}
h1 { margin-bottom: 0; text-align: center; text-shadow: #863027 0.01em 0.01em 0, #863027 0.02em 0.02em 0, #863027 0.03em 0.03em 0, #863027 0.04em 0.04em 0, #863027 0.05em 0.05em 0, #863027 0.06em 0.06em 0, #863027 0.07em 0.07em 0, #863027 0.08em 0.08em 0, #863027 0.09em 0.09em 0, #863027 0.1em 0.1em 0;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1 class="fittext">Fit me to browser width</h1>
<h1 class="fittext2">and me to half of it</h1>
<!-- The only thing that requires js -->
<h1 class="fittext-dynamic" data-width="100">and I'm dyamic!</h1>
<!-- Only necessary on document load, not window resize --> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Pure CSS FitText - Script Codes CSS Codes

@import "https://fonts.googleapis.com/css?family=Baloo+Paaji";
.fittext { font-size: 8.8vw; line-height: 1; text-align: center;
}
.fittext2 { font-size: 5vw; margin-top: 0;
}
body { background-color: #c44032; color: #f4f1de; font-family: 'Baloo Paaji', 'Impact';
}
h1 { margin-bottom: 0; text-align: center; text-shadow: #863027 0.01em 0.01em 0, #863027 0.02em 0.02em 0, #863027 0.03em 0.03em 0, #863027 0.04em 0.04em 0, #863027 0.05em 0.05em 0, #863027 0.06em 0.06em 0, #863027 0.07em 0.07em 0, #863027 0.08em 0.08em 0, #863027 0.09em 0.09em 0, #863027 0.1em 0.1em 0;
}

Pure CSS FitText - Script Codes JS Codes

'use strict';
// For dynamic character count, you could do something like this:
$('.fittext-dynamic').each(function () { var t = $(this), width = t.data("width") * 2, characters = t.html().length, size = width / characters; $(this).css('font-size', size + 'vw');
});
Pure CSS FitText - Script Codes
Pure CSS FitText - Script Codes
Home Page Home
Developer Hans Engebretsen
Username hans
Uploaded August 09, 2022
Rating 4.5
Size 3,357 Kb
Views 44,528
Do you need developer help for Pure CSS FitText?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Hans Engebretsen (hans) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!