Automatically translated.View original post

css transition

# Web Site Writing Basics

# CSS

# trasition

CSS transitions are features in CSS that make changes to properties (properties) of web elements occur smoothly instead of changing them suddenly. You can define Transition properties such as transition-delay, transition-duration, and transition characteristics (transition-timing-function) to control the change of values from one state to another, such as changing the background color gradually when the user hovers (hover) the mouse, to add a good and interesting experience to the user.

Working Principles

Change of status:

CSS transitions work when the properties of an element change in value, such as from a normal state to a hover state or focus.

Default and final values:

Transition determines the default and final values of that property.

Delay and duration:

You can set the change to start, delay, or determine the amount of time required for the change to occur gradually.

Easing Function:

You can determine the speed of change, such as starting fast and slowing down (ease-out) or changing at a linear speed.

How to use

You can define CSS transitions with the features:

Transition-property:

Identify which properties require transitions.

Transition-duration:

Determine the amount of time it takes to change the value.

Transition-delay:

Define a delay before the transition starts.

:

Determine the rate of acceleration of change.

Transitional:

It is a shortened property (shorthand) that combines these properties in one line.

Example of use

Suppose you want the background color of the button to change gently from red to blue when hovering the mouse. You can write the code as follows:

Code

. My-button {

Background-color: red;

Transition: background-color 0.5s ease-out; / * Define to change the background color in 0.5 seconds * /

}

.my-button: hover {

Background-color: blue;

}

2025/9/5 Edited to

... Read moreนอกจากการเข้าใจพื้นฐานของ CSS Transition แล้ว การเลือกใช้การเปลี่ยนแปลงที่เหมาะสมในแต่ละส่วนของเว็บก็สำคัญมาก เช่น การใช้ transition กับปุ่มที่ผู้ใช้งานจะกดบ่อยๆ จะช่วยให้รู้สึกตอบสนองได้ดีขึ้น และลดความกระทันหันของภาพที่เปลี่ยนไปอย่างรวดเร็ว ข้อควรระวังคือไม่ควรใส่ transition ในทุกองค์ประกอบพร้อมกัน เพราะจะทำให้เว็บไซต์ช้าและผู้ใช้รู้สึกว่าการเคลื่อนไหวดูเกินจริง ควรเลือกใช้เฉพาะจุดที่สำคัญ หรือเพิ่มชีวิตชีวาให้กับส่วนที่ต้องการเน้น ตัวอย่างที่ใช้ transition ยอดนิยม เช่น การเลื่อนสีพื้นหลังเมื่อโฮเวอร์เมาส์ หรือการเปลี่ยนขนาดตัวอักษรอย่างนุ่มนวล เพื่อให้เว็บไซต์ดูทันสมัยและมืออาชีพมากขึ้น ยังมีเรื่อง easing function ที่ควรทดลองใช้ เช่น ease-in, ease-out หรือ linear เพื่อปรับความรู้สึกของการเคลื่อนไหวตามความเหมาะสมของดีไซน์และประสบการณ์ผู้ใช้ หากคุณกำลังใช้เครื่องมือออกแบบอย่าง Figma ฟีเจอร์ scale strokes & effects checkbox ที่เกี่ยวข้องกับ transition ก็ช่วยให้การทำงานสะดวกและใกล้เคียงกับการโปรแกรม CSS มากขึ้น สามารถออกแบบการเปลี่ยนแปลงได้ตรงตามความต้องการมากขึ้น โดยรวมแล้ว CSS Transition ไม่ได้เป็นแค่เครื่องมือความงาม แต่ยังช่วยเพิ่มประสบการณ์ใช้งานที่ดีและลื่นไหล ทำให้เว็บดูมีชีวิตชีวาและน่าประทับใจมากขึ้นอย่างมาก ลองปรับใช้ในการทำเว็บของคุณ แล้วจะเห็นความแตกต่างอย่างชัดเจน

Related posts

IG: brncss.shay ⭐️🦋💞
#makeup #makeuptutorial #baseroutine #fullcoverage #flawlessskin #beautyproducts #TutorialMakeup
Shay Janae 🎀🍒

Shay Janae 🎀🍒

282 likes

Chevron-Style Breadcrumb Navigation in CSS
#webdesign #codinglife #studytips #codingforbeginners #breadcrumbs
Aysha

Aysha

5 likes

#freetiktok
clovescss

clovescss

13 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 dark blue graphic titled 'CSS Tips to Write Cleaner & Shorter Code!' with a lightbulb and CSS file icon. It displays a code snippet `margin: 10px 20px;` and text encouraging beginners to cut down on repetition and level up their styling game.
A graphic demonstrating CSS margin and padding shorthand. It contrasts separate `margin-top`, `margin-right`, `margin-bottom`, `margin-left` properties with the concise `margin: 10px 20px;` shorthand, explaining 10px for top/bottom and 20px for left/right.
A graphic illustrating CSS font shorthand. It compares multiple font properties like `font-style`, `font-weight`, `font-size`, `line-height`, and `font-family` with the single-line shorthand `font: italic bold 16px/1.5 'Poppins', sans-serif;` for cleaner code.
CSS Tips to Write Cleaner & Shorter Code!
#csstips #webdevelopment #learntocode #frontendtips #codebetter
Aysha

Aysha

20 likes

A dark blue background with the title 'CSS KNOWLEDGE TEST!' and a purple lightbulb icon. Text asks 'How many can you get right? comment your score below!' with a Lemon8 logo and username.
A dark blue background with a white box containing 'Q1: What does the CSS property justify-content: space-between; do?' and four multiple-choice options (A-D).
A dark blue background with a white box containing 'Q2: Which unit is relative to the parent element's font size?' and four multiple-choice options (A-D).
💡 Think you know CSS? Let’s find out!
💡 Think you know CSS? Let’s find out! Take this short quiz and see how many you get right 😎 Comment your score below 👇 #CodeWithAysha #CSSQuiz #LearnToCode
Aysha

Aysha

3 likes

A desk with a laptop and monitor, displaying the title '6 FIGURE JOBS WITHOUT A college degree' and 'SWIPE + starting pay' for job seekers.
A beach scene with job titles and starting salaries: Data Scientist ($124,000), Data Engineer ($127,000), Business Analyst ($84,000), Software Engineer ($105,000), and Engineering Manager ($131,000).
A beach with lounge chairs and umbrellas, listing jobs and salaries: Test Engineer ($95,000), Cybersecurity Engineer ($145,000), Technical Program Manager ($150,000), Product Manager ($121,000), and UI/UX Architect ($123,000).
6 figure jobs that don’t need formal education 👩‍🎓👩‍💻
1. Data Scientist 💼 Starting salary: $124,000 🚀 How to start: Learn data analysis, statistics, and machine learning. Build projects using platforms like Kaggle, and showcase your work on GitHub. 🎓 Recommended courses/bootcamps: - Multiverse Data Fellowship (15-18 months)
vedha | career tips (tech) 👩‍

vedha | career tips (tech) 👩‍

3306 likes

A title slide for "CSS ESSENTIALS Part 16: CSS TRANSITIONS." It introduces mastering CSS Transitions for smoother interactions, featuring a "Hover" button example and the creator's handle.
This slide defines CSS Transitions as creating smooth changes between property values without JavaScript. It visually contrasts "Before" (no transition) and "After" (with transition) states.
The slide presents the basic syntax for CSS Transitions: `transition: property duration timing-function delay;`. It explains that this syntax controls how the transition behaves.
What are CSS Transitions?
CSS Transitions add smooth, polished animations to your site — with just a few lines of code! ✨ Perfect for buttons, menus, hover effects & more. In this post, I’ll break down CSS Transitions so you can start using them today. 🚀 Save this guide & share with a fellow coder! 👩‍💻 #WebDe
Aysha

Aysha

4 likes

HTML and Css Fundamentals.
1. Core HTML Elements: Defines HTML as the "skeleton" of a website, explaining the use of h1 to h6 for headings, <p> for paragraphs, and styling tags like <strong> for importance, <em> for emphasis, <sub> for subscripts, and <sup> for superscripts. 2. Lists
ZeroandoneHQ

ZeroandoneHQ

1 like

The cover image for a CSS Cheatsheet for Beginners, featuring the CSS3 logo and the text "Learn the most-used properties in one place!" on a dark blue background.
A CSS Cheatsheet section detailing properties for Background (color, image, repeat, position, size), Border (border, radius, top), and Outline (outline, offset) with example values.
A CSS Cheatsheet section outlining properties for Position (relative, top, left, z-index), Size & Dimension (width, height, max-width), and Float & Clear (float, clear) with example values.
CSS CHEATSHEET for Beginners
#css3cheatsheet #learncss #webdesignbasics #frontendtips #codingforbeginners
Aysha

Aysha

31 likes

The image introduces "HTML + CSS IN ACTION: 30 Days of Mini Projects Modal Popup," showcasing a modal example with text "This is a Modal" and an "Open Modal" button. It highlights "Pop up power—no JavaScript needed" for Day 23, by Code With Aysha.
This image defines a modal popup as a small overlay that captures user attention and "locks" the screen. It displays a side panel with "Quick Settings" including Dark Mode, Font Size, Accent Color, Animations, Notifications, and Quick Links.
The image explains why building modals with HTML + CSS matters, demonstrating a "Page" and an "Overlay + Centered Card" modal. It emphasizes learning CSS selectors, visibility control, layering, transitions, and responsive centering without JavaScript.
Build a Sleek Slide-in Side Panel with HTML CSS
Build a modern slide-in side panel using only HTML and CSS! Perfect for quick settings, theme controls, and navigation links. Fully responsive and beginner-friendly — no JavaScript required. #HTMLCSS #WebDesign #FrontendDevelopment #codewithaysha
Aysha

Aysha

5 likes

This image introduces Day 2 of "HTML + CSS IN ACTION: 30 Days of Mini Projects," focusing on "Buttons with Hover Effects." It emphasizes making buttons interactive with CSS, presented by Code With Aysha.
This image illustrates the importance of hover effects by comparing a plain button to one with a hover glow. It explains that hover effects make website buttons interactive and engaging.
This image presents code for creating a button with hover effects. It includes basic HTML for the button and CSS styles for its appearance, along with a purple background and scale transform on hover.
Day 2: Buttons with Hover Effects | HTML + CSS
Welcome to Day 2 of HTML + CSS in Action! 🚀 Today we’re transforming a plain HTML button into an interactive button with hover effects using CSS. A simple touch that makes your websites feel alive and professional! #HTMLCSS #CodingForBeginners #MiniProjects #hoverbutton #codewithaysha
Aysha

Aysha

8 likes

See more