עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Variables ב CSS

Featured Replies

פורסם

הי,

אני מנסה להגדיר משתנים ב CSS וזה פשוט לא עובד לי :(

לכאורה זה אמור להיות פשוט לא?

בעיקרון כל מה שאני רוצה לעשות זה להגדיר קבוע עם איזשהו צבע ככה שאני אוכל תמיד לשנות במקום אחד את הצבע במקום לעבור על כל הקובץ. אולי יש דרך אחרת?

זה מה שניסיתי:


@variables { keyColor: #ac0303; }


.title2{
text-align: right;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:27px;
color:var(keyColor);
font-weight:bold;
}

זה פשוט שם שחור בתור DEFAULT..

תודה רבה לעוזרים.

פורסם

זה לא עובד כי CSS פשוט לא תומך במשתנים. אני לא יודע מאיפה הבאת את הסינטקס הזה אבל זה לא CSS תקני.

יש פרוייקטים שמנסים להרחיב את היכולות של CSS וכוללים תמיכה במשתנים, תבדוק את lesscss.org ואת sass-lang.com ותראה אם אחד מהם מתאים למה שאתה צריך.

פורסם
  • מחבר

צודק. בדקתי את זה עכשיו עם חבר.

בכל מקרה האלטרנטיבה היא להגדיר צבע באותו בלוק לכמה שאני רוצה.

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.