Automatically translated.View original post

How does css write?

The < style > tag in HTML is the tag used for assigning style to HTML elements using CSS (Cascading Style Sheets). It is a container for inserting CSS rules to be applied to various elements in a web page. Generally speaking, the < style > tag is placed in the < head > section of the HTML document to ensure that the style is applied when the web page loads.

< style > tag implementation:

Defines style:

Within the < style > tag, you can write CSS rules to define various characteristics of HTML elements such as color, font size, spacing, background, etc.

Formatting web pages:

The < style > tag allows you to control the formatting of web pages thoroughly, using CSS to determine the various characteristics of HTML elements.

Placement:

Generally, the < style > tag is located in the < head > section of the HTML document to ensure that the style is loaded before the content of the page.

Example:

Code

< head >

< style >

H1 {

Color: blue;

Text-align: center;

}

p {

font-size: 16px;

}

< / style >

< / head >

< body >

< h1 > topic < / h1 >

< p > paragraph < / p >

< / body >

In this example, the < style > tag requires that < h1 > be blue and centered, and p has a font size of 16px.

Importance of < style > tags:

Separation of structure and style:

The use of < style > tags separates structure (HTML) and style (CSS) assignments, which makes the code tidy and easy to maintain.

Re-adoption:

You can apply the CSS rules defined in the < style > tag to other HTML elements multiple times.

Style management:

It allows you to effectively manage the style of web pages, combining all styles in one place.

2025/8/11 Edited to

... Read moreถ้าเพิ่งเริ่มหัดทำเว็บ แล้วสงสัยว่า “css เขียนอย่างไร” แบบไม่อยากแยกไฟล์ก่อน วิธีที่ง่ายสุดคือเขียน CSS ไว้ในแท็ก <style> ภายในไฟล์ HTML เลย ซึ่งส่วนใหญ่จะวางไว้ใน <head> เพื่อให้สไตล์โหลดก่อนหน้าเว็บแสดงผล ทำให้หน้าไม่กระพริบ/เปลี่ยนสไตล์ทีหลัง 1) โครงสร้างพื้นฐานของ html style เวลาเขียนจะหน้าตาประมาณนี้ <head> <style> /* เขียนกฎ CSS ที่นี่ */ </style> </head> สิ่งที่ควรจำคือ ใน <style> ไม่ต้องใส่แท็ก HTML อื่นๆ แทรก และควรคอมเมนต์ด้วย /* */ (ไม่ใช่ <!-- -->) 2) css style เขียนกฎยังไงให้ถูก CSS จะประกอบด้วย “selector” + “{ property: value; }” เช่น h1 { color: blue; text-align: center; } หมายถึงเลือกแท็ก h1 ทุกตัว แล้วทำให้ตัวอักษรเป็นสีน้ำเงินและจัดกึ่งกลาง 3) ตัวอย่างที่เจอบ่อย: ปรับขนาดตัวอักษรและระยะห่าง p { font-size: 16px; line-height: 1.6; margin: 0 0 12px; } อันนี้ช่วยให้อ่านย่อหน้าได้สบายขึ้น (ฉันใช้บ่อยมากเวลาเขียนบทความ/หน้าแนะนำ) 4) เลือกแบบ class และ id (แนะนำเวลาหน้าเริ่มยาว) ถ้าไม่อยากให้ทุก p ถูกเปลี่ยนเหมือนกัน ให้ใช้ class .highlight { background: #fff3b0; padding: 8px; } แล้วไปใส่ใน HTML ว่า <p class="highlight">...</p> ส่วน id จะใช้กับองค์ประกอบที่มีชิ้นเดียวในหน้า เช่น #mainTitle { color: blue; } 5) วาง <style> ตรงไหนถึงเหมาะ - วางใน <head>: เหมาะสุดสำหรับหน้าเดียว/ทดลองโค้ด - ถ้า CSS เยอะ: ควรแยกเป็นไฟล์ .css แล้วใช้ <link rel="stylesheet" href="style.css"> (ดูแลง่ายกว่า) 6) ทริคเล็กๆ ที่ช่วยลดพลาด - อย่าลืมปิดวงเล็บปีกกา } และใส่ ; หลังค่าแต่ละบรรทัด - ถ้า style ไม่ทำงาน ให้เช็กสะกด selector (h1 กับ .h1 คนละความหมาย) - ลองเปิด DevTools (Inspect) ดูว่ากฎไหนถูก override อยู่ สรุปคือ tag <style> เป็นวิธีเขียน style css ที่เร็วและตรงไปตรงมาสำหรับเริ่มต้น โดยเฉพาะตอนฝึกปรับสี (color), ขนาดตัวอักษร (font-size) และการจัดวาง (text-align/margin) พอเริ่มใช้จริงหลายหน้า ค่อยย้ายไปไฟล์ CSS แยกจะทำให้จัดการง่ายขึ้นมาก

Related posts

How to write good characters
The basics of character creation #writer #writingtips #author #aspiringauthor #writing
Margaret Graves

Margaret Graves

2196 likes

Want to earn more? Master these 4 skills in 2025
1. Copywriting Imagine getting paid to write captions, ads, or emails that MAKE MONEY for brands, ghat’s copywriting for you. Start by searching “How to write persuasive copy” on YouTube. Many creators share real-world tips for beginners. Example? Alex Cattoni or Gary Vee talk about creating catch
emilie.studygram

emilie.studygram

1562 likes

If they write it, I’ll read it ✨
Some of my favorite authors!! Sophie Lark Kennedy Ryan Elle Kayson JT Giesibger LJ Shen Jescie Hall Ana Huang #lemon8bookclub #bookrecommendations #BookReview #bookshelf #lemon8challenge
B. Nicole Anderson 📚🎃

B. Nicole Anderson 📚🎃

5646 likes

A young woman works on a MacBook laptop, with the text 'free coding bootcamps' overlaid. The image is from Lemon8, featuring the user @hannahshirley.
A MacBook displays the freeCodeCamp website, showing 'Learn to code - for free' and mentioning jobs at Google, Microsoft, Spotify, and Amazon. The site offers certifications.
A MacBook displays The Odin Project website, featuring 'Your Career in Web Development Starts Here' and highlighting its free full-stack curriculum supported by an open-source community.
Learn how to code with these FREE Bootcamps! 👩🏻‍💻
I’ve worked in EdTech for a majority of my career and one of the top skills I see people wanting to learn is coding. Not only do I see students taking this interest, but also people well established in their careers who may want to learn coding for purposes of switching industries or even building
hannah 💟

hannah 💟

455 likes

A vibrant street scene with colorful umbrellas suspended overhead, featuring a pink overlay titled "How to write notes as a dyslexic student." The bottom left corner shows "Lemon8" and the user handle.
Handwritten pre-nursing notes on anatomy, detailing body cavities, abdominal quadrants with diagrams, and serous membranes. A text box suggests adding pictures and bullet points from professor's slides.
Handwritten notes on physiological concepts like positive feedback loops, core principles (structure/function, gradient), and cell communication. It includes diagrams of gradients and study tips on handwriting and drawing.
How to write notes as a dyslexic student
📒Notes: Pre-nursing classes ——————————— * does it take hours to do notes like this yes, but it’s worth it in the long run. * as long as you know what settings are best for you it’ll go by fast. #nursingstudent #collegestudent #notes
Liv hower

Liv hower

30 likes

How to Write Your First Code: Online & Offline
#codingforbeginners #learntocode #codeeditors #studymotivations
Aysha

Aysha

113 likes

Does that make you selfish??
You should never have to beg for what you deserve. You should never have to beg for the bare minimum. And you certainly should never have to feel selfish for wanting the same effort that you’re already giving! HOW could that make you selfish?? If you are needing to fight for effort from someone
jessica.writes.✨

jessica.writes.✨

59 likes

A mug with 'turn your worries into prayers' next to an open Bible, illustrating the question 'How does God speak to you? Learn how to hear His Voice!'.
An infographic listing 10 ways God speaks according to the Bible, including through the Bible, whispers, others, wise counsel, the Holy Spirit, dreams, manifestations, thoughts, and circumstances.
A graphic illustrating ways to hear God's voice through music, circumstances, dreams, the Holy Spirit, people, prayer, the Bible, and miracles, signs & wonders.
How does God speak to you? ✝️
I met with a group of Christian friends yesterday & we talked a lot about how God speaks to us! And most often, it ISN’T an audible voice. God speaks to each one of us differently, because He created us all to be unique. Pray that He will reveal Himself to you! It takes time to learn God’s
Emily 🌻

Emily 🌻

451 likes

A pink mechanical keyboard with glowing keys and colorful string lights, overlaid with text that reads "LEARN SOFTWARE DEV FOR FREE 6 RESOURCES," indicating a guide to free software development learning.
A guide titled "1. LEARN THE INTERNET" for beginners, listing key concepts like HTTPS and DNS. It recommends "Front End Masters - Sections 1-4" and shows the cover of "The Front End Developer/Engineer Handbook 2024."
A guide titled "2. LEARN HTML/CSS" for beginners, highlighting key concepts like web page structure and CSS Flexbox. It recommends "FreeCodeCamp - Responsive Web Design Course" and displays a screenshot of the course page.
Study to be a Frontend Dev - Roadmap (100% Free)
This is a study guide for becoming a Front End Developer! All resources mentioned are FREE. Don’t pay anyone for this info! Why am I not recommending a zero to job course? Two Reasons 1-There is no course that will teach you everything 2-You need to put in some sweat equity, only wat
Study Seal

Study Seal

688 likes

The image is a title slide for a guide on common HTML mistakes and their fixes. It features an illustration of a person coding on a laptop, surrounded by code snippets and language labels like HTML, CSS, and C++. The text encourages avoiding errors to write clean HTML.
This slide addresses the mistake of forgetting the `<!DOCTYPE html>` declaration. It shows incorrect HTML code without it and the correct version including it, explaining that the doctype ensures proper browser rendering.
The slide highlights the error of not using semantic HTML. It contrasts using generic `<div>` tags for everything with the correct approach of using semantic tags like `<header>` and `<section>`, emphasizing improved SEO and accessibility.
Common HTML Mistakes Beginners Make and How to Fix
#learntocode #studymotivation #success #html #webdevelopment
Aysha

Aysha

22 likes

🖊️✨ Stuck on what to write?
These journaling prompts will change your life 👏💜 Save this for your next session + watch how your pages turn into pure healing + self-discovery 🌿 #JournalingCommunity #JournalingPrompts #SelfLoveJourney #HealingThroughWriting #ManifestWithMe
Amethyst💫Pages

Amethyst💫Pages

37 likes

Journaling Really Does Make Life Better
Another week just slipped by. Through my journal, I like to pause and ask myself — how did this week actually feel? ⸻ Sometimes life just… stops moving the way you want it to. This week, I found myself second-guessing everything — feeling anxious, confused, not sure what I was doing wrong.
Comecomecomeon

Comecomecomeon

363 likes

Website to write Well-Structured Notes
Craft.do makes note-taking easy and beautiful. Create stunning documents with images, videos, and rich formatting.  Organize your ideas with a simple block-based system that helps you move and structure content effortlessly.  Need to share your work? Export it as a PDF, Markdown, or Word file
Reverelia

Reverelia

88 likes

A white desk with a hutch and a chair, featuring text overlays asking, 'Does anyone read poetry?? Should I start posting my writing on here??' with thinking and shy monkey emojis. Books and a clock are on the hutch, suggesting a creative workspace.
Does anyone actually read poetry??
Would anyone be interested in reading my poems? Let me know (I have posted some poems for Liam on here if you need a sample of my writing / get an idea of my style of writing) but most of my poetry is sAd since it is my outlet to depression. 🥺 idk if I should share?? #reading poetry is my therapy
PrincessCorina

PrincessCorina

25 likes

A hand holds several books, with the overlay text 'AUTHORS WHO WRITE THE SPiCiEST BOOKS' in white and red, against a light background. The Lemon8 logo and username are in the bottom left corner.
A book titled 'Promises & Pomegranates' by USA Today Bestselling Author Sav R. Miller, featuring pomegranates and flowers on a dark cover. The text 'SAV R MILLER' is overlaid at the top.
A book titled 'Butcher & Blackbird' by Brynne Weaver, with a pink and black cover featuring silhouettes and symbols. The text 'BRYNNE WEAVER' is overlaid at the top.
Authors who write the spiciest books
guys I’ve been in my sav r miller era, and rina kent era and it’s making me even more obsessed with dark romance lol 😭 #lemon8bookchallenge #lemon8bookclub #spiciestbooks #booktok #lemon8challenge
Readers.archive

Readers.archive

1547 likes

How to write a good cover letter
Here are some tips on how to format your cover letter if you’re having trouble how to start 🩷. #college #studenttips #collegestudent #education #schooltips
Breezy🫶🏾

Breezy🫶🏾

8 likes

The 3-Step System I Use To Write A+ Essays 🧠✨
Writing classes can be tough, especially when you’re staring at a blank page with a deadline creeping up. But once I started doing a few key things, writing became a lot more manageable, and honestly, less stressful. Start with a clear thesis statement. This is the foundation of your entire pape
CompSkyy

CompSkyy

22 likes

CSS Cheat Sheet
Essential CSS tricks every developer needs! 🔥 Save this for your next project - covers flexbox, grid, animations, and responsive design in one handy reference. Perfect for beginners and pros alike! 💻✨ #CSS #WebDevelopment #Coding #Programming #Developer
EM

EM

4 likes

A man takes a selfie in front of snowy mountains and trees under a clear blue sky. The image has a text overlay "Unveiling Myself WHO AM I?" with star graphics, and the Lemon8 logo with username "@thewellnesspirate" is visible at the bottom left.
How does this app work??
Hi my name is Dylan. I write about motivation and self growth. I take pics of mountains and sunsets. How in tf does this app work?? Does it like pictures over videos? Does anyone have any idea? Anyway, if you have insight let me know lol.
Dylan Pivarnik

Dylan Pivarnik

8 likes

The image features the title 'WHAT JOURNALING DOES TO YOUR BRAIN (ACCORDING TO SCIENCE)' in blue and pink text, overlaid on a blurred background of people writing in notebooks. It introduces the topic of journaling's scientific benefits.
This image presents a question in blue and pink text on a dark blue background: 'YOU'VE HEARD JOURNALING IS GOOD FOR YOU... BUT DID YOU KNOW IT CAN LITERALLY RESHAPE HOW YOUR BRAIN PROCESSES EMOTION, STRESS, AND MEMORY?'
The image states in blue and pink text on a dark blue background that 'JOURNALING REDUCES ACTIVITY IN THE AMYGDALA, YOUR BRAIN'S FEAR CENTER. WRITING ABOUT EMOTIONAL EVENTS HELPS CALM YOUR NERVOUS SYSTEM AND IMPROVES MOOD REGULATION.'
What Journaling Really Does to Your Brain
All of this sounds impressive… brain science, stress hormones, memory, mood. But here’s what it actually feels like in real life: It looks like catching yourself spiraling… and instead of staying stuck in your head, you move it onto the page. It looks like realizing “oh… that’s why I rea
Hannah | journal coach

Hannah | journal coach

102 likes

A laptop, a Starbucks drink, and a muffin on a wooden table, with the overlaid text "5 WEBSITES TO LEARN PROGRAMMING FOR BEGINNERS".
A MacBook Air displaying the FreeCodeCamp website, which offers free coding lessons and certifications. The text "FREECODECAMP" with an arrow points to the screen.
A MacBook Air showing the Codecademy website, featuring its basic, plus, and pro pricing plans. The text "CODECADEMY" with an arrow points to the screen.
Learn programming for free 👩‍💻
1. FreeCodeCamp - Languages: JavaScript, Python, SQL, HTML/CSS, and more. - Hands-on Projects: FreeCodeCamp is project-driven, meaning as you go through the curriculum, you'll build real-world applications like weather apps, portfolio websites, and data visualization projects. The full-
vedha | career tips (tech) 👩‍

vedha | career tips (tech) 👩‍

612 likes

A person works on a laptop with colorful stickers, displaying the text 'GitHub Copilot For Data Analysts' and 'lemon8 @yunjungintech', indicating the topic of AI assistance for data analysis.
A laptop screen shows code in an IDE, with overlay text defining GitHub Copilot as an 'AI-powered code completion tool' that provides suggestions and auto-completions for developers.
A person types on a laptop displaying code, illustrating GitHub Copilot's 'Real-time Suggestions' for coding speed and 'Language Understanding' for context-aware, convention-aligned suggestions.
How to utilize GitHub Copilot as Data Analyst
Hello everyone! I wanted to share how GitHub Copilot transforms coding workflows by integrating seamlessly into IDEs like Visual Studio Code. This AI-powered tool enhances productivity by offering real-time code suggestions and completions as developers write, tailored to the specific context and p
Yun Jung

Yun Jung

9 likes

A digital collage on a tablet screen featuring images related to YouTube, money, and inspirational quotes, with the text overlay 'How i plan my Youtube videos' and 'RICH OFF'.
A close-up of a tablet screen showing a pink background with the text 'so first i got to notes' and a blurred icon resembling a notes app.
A tablet screen displaying the Notes app with 'New videos tockey!' written in pink, and text overlay 'THEN I OPEN NOTES TO A CLEAR PAGE ND WRITE NEW VIDEOS TODAY FOR THAT DAY'.
How i plan my youtube vidoes (slide editon)💕
#digitalplanning #lemon8challenge 💕 #anthanienicole #fypシ how i plan my vidoeos for my yt channel(: !!! daily routine lol🤣 why i plan like this 1. i feel like its so neat and orginazed 2. i really like how i can change up the videos i wanna react too 3. i like how notes has so many d
Anthanie*💕

Anthanie*💕

17 likes

UI Designer - tips for a career
1. Learn the Fundamentals of UI Design -Basic Design Principles: -Typography: Learn how to use fonts effectively (size, hierarchy, readability). -Color Theory: Understand color combinations, palettes, and contrast. -Layout and Grids: Study alignment, spacing, and grid systems.
vedha | career tips (tech) 👩‍

vedha | career tips (tech) 👩‍

27 likes

A stack of books on a white textured surface with the overlaid text "AUTHORS WHO WRITE THE SPICIEST BOOKS." The Lemon8 logo is in the bottom left corner.
The book "God of Malice" by Rina Kent, featuring a dark cover with red foliage and pillars. The author's name "RINA KENT" is overlaid at the top.
The book "The Dixon Rule" by Elle Kennedy, showing a blonde woman in a cheerleading uniform on the cover. The author's name "ELLE KENNEDY" is overlaid at the top.
Authors who write the spiciest books
Here are some of my favorite authors who write rly good spice 🤭 Comment down below ur favorite spicy authors!! #lemon8bookchallenge #lemon8bookclub #lemon8bookworm #book #booktok
Readers.archive

Readers.archive

924 likes

✨👩🏾‍💻 HOW TO: Write A DAP Formatted Note For Work 💻✨
✨ Depending on how early or late I’m able to complete my workday, my evenings after my 9-5 consists of me writing progress notes and other documentation. Ima be real, progress notes can either be the easiest part of your day… or the most overwhelming if A LOT has occurred since last seeing your bel
Margarita

Margarita

34 likes

A hand holds a pink journal titled 'The Glow Up Journal' with 'New Year Journal Prompts' overlaid. The journal includes advice and prompts to set goals and make things happen, authored by Danielle Richardson, OD. The background features palm trees and a blue sky.
A journal prompt for 'Day 3' asks 'How does my best life look in 2025?' across four categories: Love + Relationships, Career + Money, Health + Wellness, and Personal Growth + Faith. Instructions advise setting a 10-minute timer for free writing.
Instructions for Day 3 Journal Prompts detail dividing a page into four categories (Love, Career, Health, Personal Growth) and setting a 10-minute timer to answer 'How does my best life look in 2025?' for each, encouraging deep brainstorming.
Day 3 Journal Prompt: How Does Life Look in 2025?
Allow yourself to envision your best life in each of the four categories and free write your answers for ten minutes. The 10-minute time limit is useful because it keeps us brainstorming and digging within even after we've run out of superficial/top-of-mind answers. Focus on next year -- wha
fierceclarity

fierceclarity

17 likes

See more