Designing a Beautiful Blog with CSS: A Beginner's Guide

![[Python 강좌] Python Flask 블로그 만들기, 지금부터 함께 시작합니다.](/uploads/editor/Python-%EA%B0%95%EC%A2%8C-Python-Flask-%EB%B8%94%EB%A1%9C%EA%B7%B8-%EB%A7%8C%EB%93%A4%EA%B8%B0-%EC%A7%80%EA%B8%88%EB%B6%80%ED%84%B0-%ED%95%A8%EA%BB%98-%EC%8B%9C%EC%9E%91%ED%95%A9%EB%8B%88%EB%8B%A4-20260706-614807.webp)
The Importance of Design
A website's functionality is important, but so is its first impression.
Even with the same content, a clean design makes reading easier and increases trust.
Conversely, if the text is cramped, buttons look awkward, and colors clash, visitors won't stay long.
This is why a good website combines both functionality and design.
In this lesson, we'll create an attractive blog using simple CSS that anyone can follow—not complex design techniques.
What Is CSS?
HTML creates the structure of a webpage.
CSS, on the other hand, handles the visual styling.
To put it simply:
HTML is like the skeleton of a house.
CSS is like decorating the walls, floors, windows, and furniture—your interior design.
They always work together.
Where to Store CSS in Flask
In Flask, static files like CSS, images, and JavaScript go into the static folder.
Create your project structure as follows:
python-flask-blog/
│
├── app.py
├── templates/
│ └── index.html
├── static/
│ └── css/
│ └── style.css
└── venv/
All future CSS files will be written inside the static/css folder.
Linking Your CSS File
Now, let's connect your HTML and CSS files.
Add this code to the <head> section of your index.html.
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
The url_for() function automatically generates the correct path for static files in Flask.
Once connected, the styles from your style.css file will apply to your webpage.
Basic Setup You Should Start With
When writing CSS, it's best to set basic styles first.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
This code removes browser-specific default margins, ensuring consistent screen appearance.
As a beginner, it's enough to understand this as a standard setup used in almost every project.
Setting Fonts and Backgrounds
The mood of your website can change dramatically just by adjusting fonts and backgrounds.
For example:
body {
font-family: Arial, sans-serif;
background: #f5f5f5;
color: #333;
}
This makes the screen feel smoother and easier to read.
Centering Content
If content stretches all the way to the edges, it becomes hard to read.
That's why centering is commonly used.
.container {
width: 1000px;
margin: 40px auto;
}
Using margin: auto naturally centers content on the screen.
Styling Headings
The blog title is one of the first things visitors see.
A small touch can make it look much better.
h1 {
font-size: 32px;
margin-bottom: 20px;
}
Clean, readable styles are more comfortable to look at over time than flashy effects.
Designing Buttons
Blogs often use buttons for actions like writing, editing, or deleting posts.
You can easily style these with CSS.
button {
background: #2b7cff;
color: white;
border: none;
padding: 10px 18px;
border-radius: 6px;
cursor: pointer;
}
Adding a subtle hover effect improves user experience.
button:hover {
background: #1d63d8;
}
Creating a Menu
Blogs typically have top navigation menus.
For example:
Home
Post List
Create Post
Login
CSS can help align these elements neatly.
nav {
display: flex;
gap: 20px;
}
The display: flex property is often used to align multiple elements in a single line.
You'll encounter this CSS technique frequently moving forward.
Margins Shape Your Design
A common beginner mistake is placing elements too close together.
Margins are crucial for good design.
For example:
.card {
margin-bottom: 25px;
padding: 20px;
}
Adding appropriate spacing makes the screen much easier to read.
Good design starts with appropriate margins, not flashy effects.
Good Habits When Writing CSS
As your project grows, so will your CSS files.
<Developing these habits early makes management much easier:
Name classes meaningfully
Group similar styles together
Avoid using too many colors
Minimize the number of fonts used
Maintain consistent spacing
These small habits lead to clean, professional-looking designs.
What Your Blog Will Look Like Next
This lesson focused on basic styling. In the future:
Post listings
Writing interface
Detail views
Login screens
Admin panels
All will share the same consistent design, creating a polished blog.
It's more important to maintain simple, readable designs than to overcomplicate them from the start.
Key Takeaways from This Lesson
The main points you should remember are:
CSS is the language used to style webpages.
In Flask, store CSS files in the
staticfolder.Use
url_for()to link your CSS file.Applying fonts, colors, and spacing well improves screen appearance significantly.
Consistency matters more than flashy design elements.
In Closing
Today we applied CSS to an HTML layout to create a basic blog design.
While still simple, this will be the foundation for future features like post listings, writing interfaces, and login pages—all using the same consistent style to build a polished, functional blog.
In our next lesson, we'll finally connect a MySQL database and create tables. This will take your blog from a simple interface to a fully functional web application that stores real data.
FAQ
Why is CSS important for web design?
CSS controls the visual styling of a webpage, making it more readable and professional while ensuring consistency across different pages.
Where should I store CSS files in a Flask project?
In Flask, static files like CSS go into the 'static' folder, typically inside a 'css' subfolder for organization.
Korean Source
This article is an English localization of a Korean-language report from BlogScore. Original: [Python 강좌] 5강. CSS로 예쁜 블로그 디자인하기