#Header logo size
6 messages · Page 1 of 1 (latest)
Hi @forest bane. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To adjust the size of your logo in the site header, you can use custom CSS styles. Here's how you can do it:
- Add a CSS file to your
src/directory. In this file, you can specify the height of your logo. For example:
/* src/styles/custom.css */
.logo {
height: 50px; /* Adjust this value to your preference */
}
- Add the path to your CSS file to Starlight’s
customCssarray inastro.config.mjs:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
export default defineConfig({
integrations: [
starlight({
title: 'Docs With Custom CSS',
customCss: [
// Relative path to your custom CSS file
'./src/styles/custom.css',
],
}),
],
});
- Apply the
.logoclass to your logo image in your HTML:
<img class="logo" src="./src/assets/my-logo.svg" alt="My Logo">
Please note that you'll need to adjust the CSS and HTML according to your project structure and requirements.
For more information, you can refer to the Starlight customization guide (https://starlight.astro.build/guides/customization#add-your-logo) and the Starlight CSS and Styling guide (https://starlight.astro.build/guides/css-and-tailwind#_top).
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@wet mango The site logo was added via astro.config.mjs, not via html
export default defineConfig({
integrations: [
starlight({
customCss: [
'./src/styles/custom.css',
],
logo: {
light: './src/assets/site-logo-light.png',
dark: './src/assets/site-logo-dark.png',
replacesTitle: true,
},
...
Let me check the knowledge base for you. One moment! :books:
I see, you're using the logo configuration in astro.config.mjs to add your logo. In this case, you can still use CSS to adjust the size of your logo, but you'll need to know the CSS selector that Starlight uses for the logo.
Unfortunately, the provided knowledge sources do not include information on what CSS selector Starlight uses for the logo, or whether it's possible to add a custom class or ID to the logo via the astro.config.mjs configuration.
As a workaround, you can inspect the logo element in your browser to find out its CSS selector, and then use that selector in your CSS file to adjust the logo size. Here's an example:
/* src/styles/custom.css */
/* Replace `selector-for-logo` with the actual selector */
.selector-for-logo {
height: 50px; /* Adjust this value to your preference */
}
Then, include the path to your CSS file in the customCss array in astro.config.mjs:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
export default defineConfig({
integrations: [
starlight({
title: 'Docs With Custom CSS',
customCss: [
// Relative path to your custom CSS file
'./src/styles/custom.css',
],
logo: {
light: './src/assets/site-logo-light.png',
dark: './src/assets/site-logo-dark.png',
replacesTitle: true,
},
}),
],
});