search
HomeWeb Front-endCSS TutorialLittle Things on My Personal Site

Little Things on My Personal Site

Recently, I gave my personal website a refresh – a fun solo project! It's my creative outlet, a space for self-expression and experimentation. This wasn't a complete overhaul, more like a fresh coat of paint. Let's explore some of the interesting techniques I used.

Typography with Hoefler Fonts

The Inkwell font family is fantastic! I love mixing weights, serifs, sans-serifs, and capitalization styles. While I used Inkwell in the previous design, I felt it was a bit too playful for blog post body text. My writing style is casual, but not always, and Inkwell's jovial nature didn't suit more serious topics. Previously, I paired it with Ideal Sans, but the combination felt off.

This time, I chose Whitney for the body copy. It maintains a lighthearted feel but works well with more straightforward content.

Styling a Blogroll with Sass

Zebra-striping a table is simple:

tr:nth-child(even) {
  background-color: var(--color-1);
}
tr:nth-child(odd) {
  background-color: var(--color-2);
}

But what about cycling through four colors? The :nth-child selector, with offsets, handles this neatly. Here's a Sass example for list items:

li {
  &:nth-child(4n) a {
    color: $blue;
  }
  &:nth-child(4n   1) a {
    color: $yellow;
  }
  &:nth-child(4n   2) a {
    color: $red;
  }
  &:nth-child(4n   3) a {
    color: $purple;
  }
}

This approach created the colorized blogroll. I used Sass due to its existing presence in the project; CodeKit handled the compilation effortlessly. And yes, blogrolls are cool again!

Efficient YouTube Embeds

I employed a clever click-to-load YouTube technique. Instead of embedding a full YouTube iframe, which loads many resources, I used a static image placeholder. This significantly improves performance while maintaining a similar user experience.

<iframe allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube.com/embed/Y8Wp3dafaMQ" srcdoc="*{padding:0;margin:0;overflow:hidden}html,body{height:100%}img,span{position:absolute;width:100%;top:0;bottom:0;margin:auto}span{height:1.5em;text-align:center;font:48px/1.5 sans-serif;color:white;text-shadow:0 0 0.5em black}<a href=https://www.youtube.com/embed/Y8Wp3dafaMQ?autoplay=1><img src=https://img.youtube.com/vi/Y8Wp3dafaMQ/hqdefault.jpg alt='Video The Dark Knight Rises: What Went Wrong? – Wisecrack Edition'>▶</a>" title="The Dark Knight Rises: What Went Wrong? – Wisecrack Edition" width="560"></iframe>

Custom Post Types and Data Structure

I'm a strong advocate for structured data. In WordPress, this often involves Custom Post Types combined with a plugin like Advanced Custom Fields. This allows flexible data handling and simplifies future site modifications.

Dynamic Bio Generator

My bio section isn't complex: I created 18 <div> elements (3 lengths <em> 2 styles </em> 3 code types) and use JavaScript to switch between them. A class string is calculated based on user selections, revealing the corresponding bio while hiding others. <pre class="brush:php;toolbar:false">$(&quot;.bio-choices input&quot;).on(&quot;change&quot;, function () { var lengthClass = &quot;.bio-&quot; $(&quot;input[name=length]:checked&quot;).attr(&quot;id&quot;); var styleClass = &quot;.bio-&quot; $(&quot;input[name=style]:checked&quot;).attr(&quot;id&quot;); var codeClass = &quot;.bio-&quot; $(&quot;input[name=code]:checked&quot;).attr(&quot;id&quot;); var selector = lengthClass styleClass codeClass; $(&quot;.bio&quot;).hide(); $(selector).show(); });</pre> <p>I used jQuery because it was already integrated into the site (along with FitVids). A future rewrite might involve removing jQuery and streamlining the bio options.</p> <h3 id="ztext-js-and-Animated-Headers">ztext.js and Animated Headers</h3> <p>The header uses ztext.js, adding a touch of webby flair. This level of animation might be less suitable for high-traffic sites, but it works well for a site with lower visitor frequency.</p> <h3 id="SVG-Backgrounds-and-Footer-Effects">SVG Backgrounds and Footer Effects</h3> <p>I utilized the updated SVG Backgrounds site to create the background. I opted for <code>background-attachment: fixed, and included a slide-out footer effect on desktop. The footer effect might need refinement; it's more impactful with a dynamic background.

Different sections use varying highlight colors, and I linked section links to their respective colors. While this might be debatable (consistent link colors are often preferred), I find it visually appealing. The filter: brightness(120%); trick ensures consistent hover and focus styles across all colors, simplifying styling.

a:focus, .button:focus,
a:hover, .button:hover {
  filter: brightness(120%);
}

This was a relatively quick update, largely inspired by a CodePen challenge. However, as always, one small change led to another, and I ended up making more significant modifications than initially planned!

The above is the detailed content of Little Things on My Personal Site. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What is CSS Grid?What is CSS Grid?Apr 30, 2025 pm 03:21 PM

CSS Grid is a powerful tool for creating complex, responsive web layouts. It simplifies design, improves accessibility, and offers more control than older methods.

What is CSS flexbox?What is CSS flexbox?Apr 30, 2025 pm 03:20 PM

Article discusses CSS Flexbox, a layout method for efficient alignment and distribution of space in responsive designs. It explains Flexbox usage, compares it with CSS Grid, and details browser support.

How can we make our website responsive using CSS?How can we make our website responsive using CSS?Apr 30, 2025 pm 03:19 PM

The article discusses techniques for creating responsive websites using CSS, including viewport meta tags, flexible grids, fluid media, media queries, and relative units. It also covers using CSS Grid and Flexbox together and recommends CSS framework

What does the CSS box-sizing property do?What does the CSS box-sizing property do?Apr 30, 2025 pm 03:18 PM

The article discusses the CSS box-sizing property, which controls how element dimensions are calculated. It explains values like content-box, border-box, and padding-box, and their impact on layout design and form alignment.

How can we animate using CSS?How can we animate using CSS?Apr 30, 2025 pm 03:17 PM

Article discusses creating animations using CSS, key properties, and combining with JavaScript. Main issue is browser compatibility.

Can we add 3D transformations to our project using CSS?Can we add 3D transformations to our project using CSS?Apr 30, 2025 pm 03:16 PM

Article discusses using CSS for 3D transformations, key properties, browser compatibility, and performance considerations for web projects.(Character count: 159)

How can we add gradients in CSS?How can we add gradients in CSS?Apr 30, 2025 pm 03:15 PM

The article discusses using CSS gradients (linear, radial, repeating) to enhance website visuals, adding depth, focus, and modern aesthetics.

What are pseudo-elements in CSS?What are pseudo-elements in CSS?Apr 30, 2025 pm 03:14 PM

Article discusses pseudo-elements in CSS, their use in enhancing HTML styling, and differences from pseudo-classes. Provides practical examples.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version