Hi! My name is Kirill Live, and I develop web applications for creativity and work.
For security reasons, many users disable JavaScript in their browsers. I often create small documentation websites where easy navigation and often offline functionality are crucial, and without scripting and back-end this is no easy task. So, I decided to gather all my experience in creating interactive websites without JS in one place.
I've observed that many developers rely too heavily on JavaScript when creating interfaces and often implement functionality that is already available in HTML and CSS without additional scripting. CSS has evolved significantly over the past 20 years, and is no longer just a tool for designers. It now has a wealth of functionality that can do a lot.
This site's repository on GitHub
You can support the project on Patreon or Boosty!
Multi-page site
Using the :target pseudo-class, you can style elements of an HTML page using the URL hash (the part of the URL that follows the pound sign #).
With its underlay, you can hide and show significant portions of a page's content. This allows you to transform a single-page website into a fully-fledged site with multiple pages that can be linked to via URLs, without the need for a backend or JavaScript.
This method isn't suitable for large portals with a lot of content or user-generated content. It's primarily suitable for smaller informational sites like documentation, portfolios or landing pages.
The perspective and translateZ functions may work differently in different browsers and produce different effects when combined with other CSS properties.
CSS for overflow
/* styles for galleries */
.parallax_bg {
height: 256px;
width: 512px;
margin-bottom:512px;
overflow: hidden auto;
/* the Z depth parameter, which creates perspective within the element */
perspective: 2px;
}
.parallax_bg > .front {
/* Determines the depth of the element, which affects scroll speed */
transform: translateZ(0);
background: rgba(0,0,0,.2);
font-size:20px;
top: 25%;
width: 100%;
height: 50%;
position: absolute;
}
.parallax_bg > .back {
font-size:42px;
background:#AAF;
/* Determines the depth of the element, which affects scroll speed */
transform: translateZ(-2px);
width: 301%;
height: 401%;
top: -50%;
left: -50%;
position: absolute;
}
CSS for body
body{
margin:0px;
}
.parallax {
height: 100vh;
overflow:hidden auto;
/* the Z depth parameter, which creates perspective within the element */
perspective: 1px;
}
.back {
position: absolute;
background:#AAF;
/* Determines the depth of the element, which affects scroll speed */
transform: translateZ(-2px);
width: 301%;
height: 301vh;
top: -100vh;
left: -100vw;
padding-top:256px;
font-size: 50px;
}
.front {
position: absolute;
/* Determines the depth of the element, which affects scroll speed */
transform: translateZ(0);
top: 0px;
left 0px;
width: 100%;
height: 200vh;
padding-top:128px;
}
Although many modern typewriters have one of several similar designs, as with the automobile, the telephone, and telegraph, several people contributed insights and inventions that eventually resulted in ever more commercially successful instruments. Historians have estimated that some form of the typewriter was invented 52 times as thinkers and tinkerers tried to come up with a workable design.
HTML
<!-- It is advisable to specify the number of characters in --n: -->
<span class="type_writer" style="--n:66">Text to display</span>
CSS Animation
.type_writer {
font-family: monospace;
font-size: 18px;
color: transparent;
/* color and style of displaying characters */
background:no-repeat left top / calc(var(--n)*1ch) 100% linear-gradient(#000);
background-clip: text;
/* speed and type of animation */
animation: show_symbols calc(var(--n)*.1s) steps(var(--n)) forwards;
}
@keyframes show_symbols{from{background-size:0 100%}}
CSS capabilities are sufficient to create a simple interactive story with the ability to choose a storyline. For more complex genres, such as dating sims, the capabilities of CSS HTML are not sufficient.
WebKit and Gecko are fairly common engines, but they differ in how they display content and the features available. You can determine which engine is being used using @media queries.
CSS
@media screen and (-webkit-min-device-pixel-ratio:0) {
body { background-color:#aaf;}
body:after{content:"WebKit";}
}
@media screen and (min--moz-device-pixel-ratio:0) {
body { background-color:#afa;}
body:after{content:"FireFox";}
}
Additionally, you can check in CSS whether a property, rule, or selector is supported by the browser. If the condition is met, the CSS code written within the curly braces will be executed.
CSS
@supports (display: grid) and (grid-template-columns: subgrid) {
body:after{
content:"\"Display: Grid\" is supported.";
}
}