HTML: הגדר קודי צבע - איך זה עובד
ניתן להגדיר צבעים ב- HTML בדרכים שונות. אנו מראים לך כיצד לעשות זאת.
הגדר קודי צבע ב- HTML
בעיקרון, באפשרותך להגדיר צבעים ב- HTML בשתי דרכים - עם שמות צבע או קוד hexcodes. ניתן לזכור יותר את שמות הצבעים, אך מרבית מפתחי האינטרנט משתמשים בקודדי hex לקוד הצבעים:
- Hexcode: למספר ההקסדצימאלי תמיד יש שש ספרות לקידוד צבע. שתי הספרות הראשונות עומדות על הרכיב האדום, שתיים הקרובות לירוק והשתי האחרונות עבור הרכיב הכחול. תמיד יש שלט יהלום מול צבע: "#". כך שתוכל להגדיר צבע רקע אדום כזה: "". שימו לב כי האיות מיושן ללא גיליונות סגנון. לדוגמה, הימנע מקוד זה: "".
- שמות צבע: הם למעשה פועלים באותו אופן כמו קודי hex. אתה יכול ליצור רקע אדום כזה: "". תוכלו למצוא טבלאות מפורטות עם מאות שמות צבעוניים באינטרנט.
זה מקצועי יותר להעביר את הגדרות הצבע לגיליון סגנונות חיצוני (CSS). בטיפ מעשי אחר, אנו מסבירים את ההבדלים בין HTML ל- CSS.