Automatically translated.View original post

content #3

# Web Site Writing Basics

# appscript

# google

1.The HTML Structure

First, build your HTML file infrastructure, consisting of two main parts: the ON / OFF button and the Modal box itself.

HTML

< div class = "toggle-container" >

< input type = "checkbox" id = "modal-toggle" class = "modal-toggle" >

< label for = "modal-toggle" class = "toggle-button" >

Open Modal

< / label >

< div class = "modal" >

< div class = "modal-content" >

< label for = "modal-toggle" class = "close-button" >

& times;

< / label >

< h2 > This is your Modal. < / h2 >

< p > You can put any content here...< / p >

< / div >

< / div >

< / div >

< input type = "checkbox" >: This is the key to this technique. We will use the Checkbox checked or unchecked state as the Modal Display Controller.

< label >: Used to connect to input using the attribute for which a value matches the id of input. Clicking < label > will cause the Checkbox to be checked or unchecked.

< div class = "modal" >: This is the Modal box that we will hide at first.

2. CSS Management (The CSS Magic)

In the CSS section, we will use a special option (pseudo-classes) and a sibling combinator option to control the display of the Modal.

CSS

/ * Hide the real Checkbox * /

.modal-toggle {

Display: none;

}

/ * Set Modal default to hide * /

.modal {

Visibility: hidden;

Opacity: 0;

Transition: visibility 0s, opacity 0.5s; / * cause Fade-in / out effect * /

Position: fixed;

Top: 0;

Left: 0;

width: 100%;

Height: 100%;

Background-color: rgba (0, 0, 0, 0.5); / * Opaque background * /

Display: flex;

Justify-content: center;

align-items: center;

}

/ * When the Checkbox is selected (checked), display Modal * /

.modal-toggle: check ~ .modal {

Visibility: visible;

Opacity: 1;

}

/ * Decoration other parts as needed * /

.modal-content {

Background-color:# fff;

padding: 20px;

Border-radius: 8px;

width: 80%;

Max-width: 500px;

Position: relative;

Transform: translateY (-20px);

Transition: transform 0.5s ease-out;

}

.modal-toggle: check ~ .modal-content {

Transform: translateY (0);

}

. Close-button {

Position: absolute;

Top: 10px;

Right: 15px;

font-size: 24px;

Cursor: pointer;

Color:# aaa;

}

.toggle-button {

Cursor: pointer;

padding: 10px 20px;

Background-color: # 007bff;

Color: white;

Border-radius: 5xx;

Text-decoration: none;

Display: inline-block;

}

• .modal-toggle: check: This is the heart of the entire mechanism when the Checkbox is clicked until it is checked.

• ~ (General Sibling Combinator): This option selects the .modal element next to the .modal-toggle: checked element at the same level.

• visibility: visible; and opacity: 1;: When the above conditions are true, we change these properties to make the hidden Modal show up.

Working summary

When the user clicks on the "Open Modal" button, which is actually < label >, < input type = "checkbox" id = "modal-toggle" > changes the state to checked. When < input > is checked, the CSS Selector .modal-toggle: checked ~ .modal causes the previously hidden Modal to appear. When you click the "×" button, which is < label > that points back to < input > again, < input > changes the state back to unchecked, and the Modal hides down again.

2025/9/23 Edited to

... Read moreสำหรับใครที่กำลังมองหาวิธีทำให้เว็บไซต์มีความทันสมัยและเพิ่มความน่าสนใจ การใช้ Modal โดยควบคุมด้วย CSS อย่างเดียว ถือเป็นเทคนิคง่าย ๆ ที่ไม่ต้องใช้ JavaScript เลย เป็นประโยชน์สำหรับผู้เริ่มต้นและนักพัฒนาเว็บที่ต้องการทำงานให้เร็วขึ้นและบำรุงรักษาง่าย เทคนิคนี้ใช้ประโยชน์จาก Checkbox element ที่คอยตรวจสอบสถานะ checked หรือ unchecked ซึ่งเมื่อมีการคลิกปุ่มเปิด Modal (ซึ่งแท้จริงคือ label ที่เชื่อมต่อกับ input checkbox ผ่าน for กับ id) ก็จะทำให้ Modal ปรากฏขึ้นทันทีโดยไม่ต้องเขียนสคริปต์ใด ๆ ซึ่งถือเป็นวิธีที่ประหยัดเวลาทั้งการเขียนและโหลดหน้าเว็บ นอกจากนี้ยังสามารถปรับแต่ง CSS เพื่อเพิ่มลูกเล่น เช่น การใช้ transition ทำให้ Modal ค่อย ๆ แสดงผลแบบนุ่มนวล หรือใช้ opacity และ visibility ควบคุมการมองเห็นอย่างมีประสิทธิภาพ การออกแบบให้มีปุ่มปิดที่ชัดเจนช่วยให้ผู้ใช้มีประสบการณ์ที่ดี และถ้าคุณนำไปประยุกต์ใช้กับระบบแจ้งเตือนหรือป็อปอัปต่าง ๆ ก็จะช่วยให้เว็บของคุณดูโปรและตอบสนองต่อผู้ใช้งานได้ดีขึ้น นอกจากโค้ดตัวอย่างที่แชร์ในบทความแล้ว ผมแนะนำให้ลองปรับสี ปรับขนาดหน้าต่าง Modal และทดลองเพิ่มเนื้อหาแบบฟอร์ม หรือวิดีโอ เพื่อดูผลลัพธ์ที่แตกต่าง และเสริมการใช้งานจริงให้มากขึ้น เทคนิคนี้เหมาะกับเว็บไซต์ที่ต้องการความเบาและรวดเร็ว พร้อมกับประหยัดทรัพยากร เนื่องจากไม่ต้องโหลดสคริปต์เพิ่มเติม สรุปว่าการใช้ CSS ร่วมกับ HTML input checkbox เป็นวิธีที่เก๋และใช้งานได้จริง เรียนรู้ไว้ไม่เสียหายครับ แล้วคุณจะได้เครื่องมือเพิ่มสีสันให้กับเว็บไซต์ของตัวเองอย่างง่ายดาย

Related posts

Content Creation Tools📸
These are the tools I use to create my content, and I absolutely LOVE LOVE LOVE each of them🤍. Remember to 📌 save this list and follow @digitalitgirl_ for more tips on content tips, digital marketing and digital products. #contentcreator #contentcreatortips #amazonmusthave #lemon8cre
Mya Chanell

Mya Chanell

4261 likes

A pink iPhone and a pink iPad are displayed on a textured surface, with text overlays indicating 'Content DOWNLOAD APPS FOR IPHONE & IPAD' and 'LEM·N8 DIARY'.
The text 'iPad Planner' is shown in black font on a white background, representing an app for planning on an iPad.
The app icon for GoodNotes is displayed, featuring a black pen and blue lines on a white square with rounded corners.
Content Apps For IPhone & IPad 💕
Here are some great apps for iPhone, Android, and iPad to help you with content creation, whether it’s for notes, templates, or drawing. These apps can enhance your creativity, streamline your workflow, and make content creation. #appstodownload #appsforcontentcreator #appsforgraphicdesigners
Daijah Lashae

Daijah Lashae

1188 likes

30 days of faceless content ideas!! 🍋🍋
30 days of faceless content ideas!! More faceless resources 🔗 in my bio! #digitalmarketing #letschat #lemon8contest #digitalproducts #ugccreator
DIGITAL VIRAL BOSS

DIGITAL VIRAL BOSS

4937 likes

PLAN YOUR CONTENT LIKE A PRO 🌸
Feeling overwhelmed with your content? 😖😓 I know the feeling! 🙏🏽 There are so many different elements to consider when planning your content, and it can be a very daunting task, especially as a new creator. Say goodbye to stress and hello to success with our Content to Coins Digital Workb
Jai ❤️

Jai ❤️

954 likes

A woman with dark hair, wearing a dark top, sits in a car. Text overlay reads "APPS I USE AS A Content Creator." White squiggly lines frame her, with "Lemon8" and a username at the bottom.
A CapCut app icon with a '62' notification badge is shown above an iOS menu. The menu displays options like "Upload projects," "Edit Home Screen," "Share App," and "Remove App." Text describes CapCut's video editing features.
A purple "CAPTIONS" app icon is displayed above an iOS menu. The menu includes options for feedback, "Edit Home Screen," "Share App," and "Remove App." Text highlights the app's speech-to-text transcription for captions.
MUST-Have apps as a CONTENT creator 📸‼️
These apps are essential tools for any content creator. They offer powerful features for video editing, photo enhancement, captioning, and design, helping you create professional-quality content with ease. Download them now to elevate your creative process and bring your ideas to life! #content
That’s So Whitney

That’s So Whitney

3584 likes

Part 11 of mw posting my old boba content
#boba🧋 #bobatime #bobadrink #poppingpearls #hopetriesthings
🌸Hope🌸

🌸Hope🌸

910 likes

100 CONTENT IDEAS‼️(NO 💵 required)
These content ideas can be created with what you already have and without spending any money. Can’t wait to see the ones you guys pick 🫶 #contentcreatortipsforbeginners #creatorideas #fypシ゚
That’s So Whitney

That’s So Whitney

10.9K likes

A person is writing in a notebook, with the text 'NẮM CHẮC CẤU TRÚC PAS ✨ cho con dân content' (Mastering the PAS structure for content creators) overlaid, introducing the topic.
A person is writing in a notebook, with text defining 'CẤU TRÚC ✨ PAS' as an acronym for Problem, Agitate, and Solve, explaining its components.
A person is writing in a notebook, featuring a portrait of Dan Kennedy. Text states that the PAS structure was created by advertising master Dan Kennedy.
NẮM CHẮC CẤU TRÚC PAS DÀNH CHO CON D N CONTENT 🖍️
Khi viết một post nào đó có rất nhiều cách để tớ áp dụng, vì thế mà 1001 câu hỏi “làm sao bắt đầu một bài content hiệu quả” không quá khó khăn với tớ Một trong số đó là cấu trúc PAS đã được tớ bí mật áp dụng theo, vậy pas là gì hãy theo chân Hồn Văn Chương tìm hiểu ngay nha! 👇🏻 📍 PAS là gì ?
Hồn Văn Chương

Hồn Văn Chương

12 likes

ChatGPT Prompt for content Ideas Part 1
Prompt: “Generate a list of content ideas related to [your niche] for social media posts.” Remember, the effectiveness of these prompts will depend on how well they're tailored to your audience's interests and needs. Experiment with different types of content to see what resonates most
Imani

Imani

88 likes

A woman holds a smartphone, with overlay text 'ONE MONTH OF CONTENT PROMPTS FOR MAY'. It's a guide for content ideas from @theellecottrell, encouraging users to swipe for more.
Content prompts for Day 1-4, including a picture of yourself, a single graphic, a reel debunking a myth, and a carousel tutorial for ideal clients.
Content prompts for Day 5-10, featuring self-care day, social detox, single graphics about tools and goals, and a live/reel for achieving specific goals.
One Month of Content Ideas & Prompts for You
Comment/DM “COURSE” for Free Content Marketing Course & chance to win a social media audit x strategy! 🚀 November is almost here! Swipe through for a handful of versatile content ideas for this month! Each of these can be used with a product or service based business. If you have any que
Iamelleross

Iamelleross

186 likes

CÓ IDEA CONTENT KHÔNG LO CHẾT ĐÓI ✏️
Content là một ban khiến ai cũng “sợ” khi nói đến vì việc phải nảy ra các ý tưởng viết thành bài đã là khó … … nhưng việc ý tưởng có đâu ra lại càng đau đầu hơn Thế nhưng với Hồn Văn Chương việc tìm content viết chỉ là một việc dễ như ăn cháo khi nắm được các bí quyết này! 📝 Bổ sung kiến thứ
Hồn Văn Chương

Hồn Văn Chương

23 likes

A laptop screen displays an Instagram-like interface with images and the text "CONTENT CREATOR Portfolio" overlaid, suggesting a digital portfolio.
This image illustrates steps for creating a portfolio on Canva, including signing up, choosing a template from options like 'UGC Creator Pitch Deck', and customizing it with personal branding.
This image shows how to add content like videos and graphics to a Canva portfolio, and how to edit, enhance, and include testimonials or endorsements using Canva's tools.
How To Make A Content Creator Portfolio ?
Creating a content creator profile is very important especially when you’re trying to email brands to work with them. Also creating a portfolio makes you very organized and what’s the brand and know everything that you do but in a more professional way . Creating a portfolio is very easy and doesn’
𝒮𝒽𝒶𝓎𝓁𝒶☆

𝒮𝒽𝒶𝓎𝓁𝒶☆

93 likes

LAZY ChatGPT Content Growth Hack
👀 2024 Content Hack for Lazy People - Part 2🫠 💬DM/Comment “CONTENT” for more ChatGPT Prompts & 365+ Content Ideas that Convert 🚀 This is a prompt I've personally used to help me create content for my social media marketing strategy, email marketing, sales funnels and YouTube video ide
Iamelleross

Iamelleross

845 likes

Content Creator kit - Sony ZV E10
Heyy Besties, as a reward for meeting my goal of 1500 subscribers I decided to go ahead and purchase my first camera, the Sony ZV E10. I never imaged that I would be in the position to make such a purchase. I’m truly in love with this camera and can’t wait to continue making and producing excellent
SeasonsBestByResa

SeasonsBestByResa

231 likes

CONTENT CREATING ESSENTIALS
Here are few items i use when creating content . I think trying new things can always benefit you in the long run because enhancing your content can lead to many opportunities. Sometimes all you need is a new light or new camera . But don’t think you need everything just starting . Content is a gr
GabrielleAlana

GabrielleAlana

165 likes

My Content Creation Essentials 📷
Just a few of my content creation essentials ! 💚 Everything here is on my Amazon store which is linked in my bio. • iPhone 14 Pro Max - This is pretty much is most important content creation item to me lol. I take pictures, go live, edit, and record a lot of my content on my phone! I also move
Dari ✨

Dari ✨

191 likes

A person records with a smartphone on a desk, next to another phone displaying 'Later' and a lamp, introducing '5 Apps I Swear By As a Content Creator & SMM Part 2'.
A laptop screen displays the Asana project management interface with tasks and projects, illustrating its use for social media management and personal content creation.
A laptop screen shows the Later app interface for scheduling and analyzing social media content, highlighting its features for planning posts and identifying trends.
5 Apps I swear by as a content creator & a SMM 2
Stepping up the content creation game means finding the right tools that work as hard as you do. Here's Part 2 of my top app picks that are essential in my daily grind as a content creator and SMM! 🚀✨ Asana: My organizational powerhouse. It's like having a digital project manager who kee
Ayesha 🍋

Ayesha 🍋

1075 likes

Content Creating Looks So Beautiful
#contentcreatorfinds #fyp #foryoupageofficiall #contentcreators #viral
𝑩𝒆𝒏𝒊𝒉𝒂𝒏𝒂𝒂 ⋆𐙚

𝑩𝒆𝒏𝒊𝒉𝒂𝒏𝒂𝒂 ⋆𐙚

224 likes

A pink package containing a plush item and smaller boxes, all featuring a distinct logo, surrounded by branded packaging material with pill-like shapes. This is a beauty collaboration package.
A cardboard box filled with multiple skincare products, including creams, serums, and cleansers, from a beauty line, nestled in patterned tissue paper. This is a beauty collaboration package.
A package containing various beauty items in orange and light purple boxes, along with a promotional card featuring a person's face and a beauty product logo. This is a beauty collaboration package.
PACKAGES I RECEIVED AS A BEAUTY CONTENT CREATOR
This is all pr/ collaboration packages I received this month from brands:) all reached out via dm or email. So grateful for everything🫶 #sephora #prhaul #pr #makeup #skincare #kosas #caudalie #kulfibeauty #dridriss #theinkeylist
Sofya

Sofya

741 likes

See more