You're absolutely right! My apologies. When using display: flex on the app-links container, a single item (or a few items that don't fill the entire row) can sometimes stretch to occupy the remaining space, especially in certain browser rendering contexts or when the parent container shrinks.
To prevent the buttons (.app-link) from stretching and ensure they only take up their natural content width, we need to explicitly tell the flex items not to grow.
Here's the updated CSS for the .app-link class. I've added flex-grow: 0; flex-shrink: 0; flex-basis: auto; to ensure they maintain their size based on content and padding, rather than expanding to fill available space.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Extensions - TrackSite</title>
<style>
:root {
--primary-red: #e53935;
--dark-bg: #121212;
--light-bg: #1d1d1d;
--text-primary: #f0f0f0;
--text-secondary: #a0a0a0;
--border-color: #333333;
--card-bg: rgba(255, 255, 255, 0.05);
--shadow-color: rgba(229, 57, 53, 0.2);
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
color: var(--text-primary);
background: #181818;
margin: 0;
padding: 0;
}
.content {
max-width: 900px;
margin: 0 auto;
padding: 40px 20px 20px 20px;
}
.page-header {
margin-bottom: 40px;
text-align: center;
}
.page-title {
font-size: 2.5rem;
font-weight: 800;
margin-bottom: 10px;
background: linear-gradient(135deg, var(--primary-red), #ff6b6b);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
word-break: break-word;
}
.page-subtitle {
color: var(--text-secondary);
font-size: 1.2rem;
max-width: 700px;
margin: 0 auto;
line-height: 1.6;
}
.section {
margin-bottom: 50px;
}
.section-title {
font-size: 1.5rem;
color: var(--primary-red);
font-weight: 600;
margin-bottom: 25px;
border-bottom: 2px solid var(--border-color);
padding-bottom: 10px;
}
.apps-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 16px;
}
.app-card {
background: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 10px;
padding: 15px;
transition: all 0.3s ease;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.app-card:hover {
border-color: var(--primary-red);
box-shadow: 0 8px 25px var(--shadow-color);
}
.app-name {
font-size: 1.1rem;
font-weight: 600;
color: var(--text-primary);
margin-bottom: 8px;
display: flex;
justify-content: space-between;
align-items: center;
}
.app-description {
color: var(--text-secondary);
line-height: 1.5;
font-size: 0.9rem;
flex-grow: 1;
margin-bottom: 12px;
}
.app-links {
display: flex;
gap: 8px;
flex-wrap: wrap;
margin-top: auto;
/* Ensure items align to start if there's extra space */
justify-content: flex-start;
}
.app-link {
padding: 4px 10px;
background: rgba(229, 57, 53, 0.1);
border: 1px solid var(--primary-red);
color: var(--primary-red);
text-decoration: none;
border-radius: 4px;
font-size: 0.8rem;
transition: all 0.3s ease;
white-space: nowrap;
/* --- IMPORTANT CHANGE HERE --- */
/* Prevent flex item from growing or shrinking, take natural width */
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
}
.app-link:hover {
background: var(--primary-red);
color: white;
}
.script-toggle {
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--border-color);
border-radius: 4px;
color: var(--text-secondary);
cursor: pointer;
font-size: 0.8rem;
padding: 2px 8px;
margin-left: 10px;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
justify-content: center;
height: 24px;
}
.script-toggle:hover,
.script-toggle.expanded {
background: var(--primary-red);
color: white;
border-color: var(--primary-red);
}
.script-links {
max-height: 0;
overflow: hidden;
transition: max-height 0.3s ease, margin-top 0.3s ease;
margin-top: 0;
padding-left: 10px;
border-left: 2px solid var(--border-color);
margin-left: 8px;
}
.script-links.show {
max-height: 500px;
margin-top: 10px;
}
.script-link {
display: block;
padding: 6px 10px;
margin: 4px 0;
background: rgba(255, 255, 255, 0.03);
border: 1px solid var(--border-color);
border-radius: 4px;
color: var(--text-secondary);
text-decoration: none;
font-size: 0.85rem;
transition: all 0.2s ease;
}
.script-link:hover {
background: rgba(229, 57, 53, 0.1);
border-color: var(--primary-red);
color: var(--primary-red);
}
@media (max-width: 600px) {
.content {
padding: 20px 5px;
}
.page-title {
font-size: 1.5rem;
}
}
</style>
</head>
<body>
<div class="content">
<div class="page-header">
<h1 class="page-title">Extensions</h1>
<p class="page-subtitle">Adblockers, filters, etc.</p>
</div>
<!-- Adblockers Section -->
<section class="section" id="adblockers">
<h2 class="section-title">Adblockers</h2>
<div class="apps-grid">
<div class="app-card">
<h3 class="app-name">uBlock Origin</h3>
<p class="app-description">Efficient, powerful ad blocker with low resource usage</p>
<div class="app-links">
<a href="https://ublockorigin.com/" class="app-link" target="_blank">Download</a>
<a href="https://github.com/gorhill/uBlock" class="app-link" target="_blank">GitHub</a>
</div>
</div>
<div class="app-card">
<h3 class="app-name">Privacy Badger</h3>
<p class="app-description">Blocks invisible trackers and spying ads</p>
<div class="app-links">
<a href="https://privacybadger.org/" class="app-link" target="_blank">Download</a>
</div>
</div>
<div class="app-card">
<h3 class="app-name">Ghostery</h3>
<p class="app-description">Privacy protection and tracker blocking</p>
<div class="app-links">
<a href="https://www.ghostery.com/" class="app-link" target="_blank">Download</a>
<a href="https://www.ghostery.com/faqs/" class="app-link" target="_blank">FAQs</a>
</div>
</div>
<div class="app-card">
<h3 class="app-name">Malwarebytes Browser Guard</h3>
<p class="app-description">Blocks ads, trackers, and malware</p>
<div class="app-links">
<a href="https://www.malwarebytes.com/browserguard" class="app-link" target="_blank">Download</a>
</div>
</div>
</div>
</section>
<!-- Filters Section -->
<section class="section" id="filters">
<h2 class="section-title">Filters</h2>
<div class="apps-grid">
<div class="app-card">
<h3 class="app-name">FMHY-SafeGuard</h3>
<p class="app-description">A comprehensive filter list of unsafe sites</p>
<div class="app-links">
<a href="https://github.com/fmhy/FMHY-SafeGuard" class="app-link" target="_blank">GitHub</a>
<a href="https://github.com/fmhy/FMHYFilterlist" class="app-link" target="_blank">View List</a>
</div>
</div>
<div class="app-card">
<h3 class="app-name">Dark Reader</h3>
<p class="app-description">Dark mode for every website with eye care</p>
<div class="app-links">
<a href="https://darkreader.org/" class="app-link" target="_blank">Download</a>
<a href="https://github.com/darkreader/darkreader" class="app-link" target="_blank">GitHub</a>
</div>
</div>
</div>
</section>
<!-- Website Scripts Section -->
<section class="section" id="website-scripts">
<h2 class="section-title">Website Scripts</h2>
<div class="apps-grid">
<div class="app-card">
<h3 class="app-name">
Violentmonkey
<button class="script-toggle collapsed" aria-label="Toggle scripts">more</button>
</h3>
<p class="app-description">Browser extension for managing userscripts</p>
<div class="app-links">
<a href="https://violentmonkey.github.io/" class="app-link" target="_blank">Website</a>
</div>
<div class="script-links">
<a href="https://greasyfork.org/en/scripts/485772-fmhy-base64-auto-decoder" class="script-link" target="_blank">Base64 Decoder</a>
<a href="https://greasyfork.org/en/scripts/507904-chatgpt-jailbroken-use-it-for-whatever" class="script-link" target="_blank">Jailbroken ChatGPT</a>
</div>
</div>
</div>
</section>
</div>
<script>
// Script Toggle Functionality
document.addEventListener('DOMContentLoaded', function() {
const toggleButtons = document.querySelectorAll('.script-toggle');
toggleButtons.forEach(button => {
button.addEventListener('click', function() {
const card = this.closest('.app-card');
const scriptLinks = card.querySelector('.script-links');
this.classList.toggle('expanded');
this.classList.toggle('collapsed');
scriptLinks.classList.toggle('show');
});
});
});
</script>
</body>
</html>
Key Change:
In the <style> block, within the .app-link CSS rule, I added these lines:
flex-grow: 0;
flex-shrink: 0;
flex-basis: auto;
flex-grow: 0;: Prevents the item from growing to fill any extra space in the flex container.
flex-shrink: 0;: Prevents the item from shrinking below its content size (useful if the container gets too small, though white-space: nowrap also helps here).
flex-basis: auto;: Tells the item to take its width based on its content before any growing or shrinking occurs.
These properties ensure that the buttons will only take up the space they naturally need, regardless of how many buttons are in the app-links container.