0Pricing
Next.js 15 Fullstack (App Router + Server Actions) · درس

تنسيق تطبيق Next.js الخاص بك

أضف التنسيقات إلى تطبيق Next.js 15 باستخدام CSS العام، وCSS Modules، وTailwind CSS ضمن App Router.

تنسيق تطبيق Next.js الخاص بك درس مجاني في Next.js 15 Fullstack (App Router + Server Actions) على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Next.js 15 Fullstack (App Router + Server Actions)، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Next.js 15 Fullstack (App Router + Server Actions) 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Styling Options Overview

Next.js supports several styling approaches out of the box: global CSS, scoped CSS Modules, utility-first Tailwind, and CSS-in-JS libraries.

Global Stylesheet

Global CSS is imported once in the root layout and applies to every page — ideal for resets and base typography.

import "./globals.css";
export default function RootLayout({ children }) {
  return (<html lang="en"><body>{children}</body></html>);
}

CSS Modules for Scope

A CSS Module (x.module.css) generates locally-scoped class names, so component styles never leak into each other.

import styles from "./button.module.css";
export default function Button() {
  return <button className={styles.primary}>Click</button>;
}

Inside the Module File

Inside a module you write class names normally — Next.js hashes them at build time to keep them unique.

.primary {
  background: rebeccapurple;
  color: white;
  padding: 8px 16px;
}

Tailwind CSS

Tailwind gives you utility classes you compose right in your markup. It's the most common styling choice in modern Next.js apps.

export default function Card() {
  return <div className="rounded-lg bg-white p-4 shadow">Hello</div>;
}

Setting Up Tailwind

To set up Tailwind, install it and add its three directives to your global stylesheet so the utility classes become available.

@tailwind base;
@tailwind components;
@tailwind utilities;

Conditional Classes

Toggle classes by state for conditional styling. A helper like clsx keeps the logic clean and readable.

import clsx from "clsx";
<button className={clsx("btn", isActive && "btn-active")} />

Fonts with next/font

The next/font module self-hosts fonts with zero layout shift and no extra request to a font provider — performant typography for free.

import { Inter } from "next/font/google";
const inter = Inter({ subsets: ["latin"] });

Server vs Client Styling

Global CSS and CSS Modules work in Server Components. Some CSS-in-JS libraries need a Client Component boundary or special setup.

Responsive Design

Tailwind's responsive prefixes like md: and lg: apply styles at breakpoints, making mobile-first layouts effortless.

<div className="text-sm md:text-base lg:text-lg">Responsive text</div>

Choosing an Approach

Pick by job: CSS Modules for component isolation, Tailwind for fast utility-driven UI, and global CSS for resets and base typography.

Quick Check

What does a CSS Module give you that a global stylesheet does not?

Recap

Recap: Next.js styling spans global CSS, scoped CSS Modules, and Tailwind utilities, plus next/font for fast type and responsive breakpoints.

الأسئلة الشائعة

هل درس «تنسيق تطبيق Next.js الخاص بك» مجاني؟

نعم — نص درس «تنسيق تطبيق Next.js الخاص بك» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Next.js 15 Fullstack (App Router + Server Actions)، انتقل إلى CoddyKit PRO. تتضمن دورة Next.js 15 Fullstack (App Router + Server Actions) 4 دروس في المجموع.

ماذا ستتعلم في «تنسيق تطبيق Next.js الخاص بك»؟

أضف التنسيقات إلى تطبيق Next.js 15 باستخدام CSS العام، وCSS Modules، وTailwind CSS ضمن App Router. تتمرن على Next.js 15 Fullstack (App Router + Server Actions) مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Next.js 15 Fullstack (App Router + Server Actions)؟

لا تُشترط خبرة سابقة. Next.js 15 Fullstack (App Router + Server Actions) على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «تنسيق تطبيق Next.js الخاص بك»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Next.js 15 Fullstack (App Router + Server Actions) هذا؟

نعم. كل درس في Next.js 15 Fullstack (App Router + Server Actions) يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. إعداد المشروع وCLI
  2. أساسيات التوجيه المعتمد على نظام الملفات
  3. نظرة عامة على الصفحات والتخطيطات
  4. تنسيق تطبيق Next.js الخاص بك
← العودة إلى Next.js 15 Fullstack (App Router + Server Actions)