<sup id="qomy4"></sup>
  • <dfn id="qomy4"><rt id="qomy4"></rt></dfn>\n

    This page is a demo <\/h1>\n<\/body>\n<\/html><\/pre>\n

    程式碼片段:<\/strong><\/p>\n

    \"HTML<\/p>\n

    要新增背景顏色,可以使用 bgcolor 屬性來顯示 <\/p> body bgcolor=''>.它與除 HTML 5 之外的所有瀏覽器相容。

    \n<\/strong>代碼:<\/p>\n

    Color Name<\/h3>\n

    Hexadecimal<\/h3>\n

    RGB Value<\/h3><\/pre>\n

    \n<\/h3>如何為 HTML 中的文字套用顏色?

    \n<\/p>對(duì) HTML 文字套用顏色非常簡(jiǎn)單;我們可以透過三種方式添加\/更改文字的顏色,即十六進(jìn)位顏色、HSL 值和顏色名稱。以下是將顏色應(yīng)用到對(duì)應(yīng)網(wǎng)頁(yè)的三種不同技術(shù)。

    \n<\/h4>1.顏色名稱

    \n<\/p>當(dāng)應(yīng)用程式直接使用這些顏色名稱時(shí),使用英文顏色名稱非常簡(jiǎn)單。指定顏色名稱是直接方法,W3C已經(jīng)公佈了16種基本顏色(黑色、黃色、紅色、栗色、灰色、石灰、綠色、橄欖色、銀色、水色、藍(lán)色、海軍藍(lán)、白色、紫色、紫紅色、青色)

    \n\n\n<\/h4>2.福勝利

    \n<\/p>色相飽和度和亮度顏色值。色調(diào)定義為 0 到 360 度,飽和度和亮度定義為 0 到 100 %。

    \n<\/h4>3.十六進(jìn)位顏色

    \n<\/p>為了得到精確的結(jié)果,應(yīng)用六位十六進(jìn)位數(shù)。詳細(xì)來說,前兩位表示紅色,後兩位表示綠色,另外兩位表示藍(lán)色值,前面有「#」。

    \n<\/p>以下範(fàn)例解釋了向文件應(yīng)用顏色的不同方法。

    \n<\/strong>代碼:<\/p>\n

    \nEDUCBA<\/title>\n<style type=\"text\/css\">\nh1{\ncolor:#97cae0;\nbackground-color: hsl(200, 50%, 20%);\ncolor: hsl(200, 20%, 90%);\n}\nh4{\ncolor:rgb(0, 255, 0);\nbackground-color: hsl(130, 10%, 30%);\ncolor: hsl(280, 20%, 80%);\n}\nli{\ncolor:rgba(12, 88, 120, 1);\nbackground-color: hsl(210, 36%, 50%);\ncolor: hsl(145, 45%, 81%);\n}\n<\/style>\n<\/head>\n<body>
    <h1><a href="http://m.miracleart.cn/">国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂</a></h1>\n<h1>EDUCBA<\/h1>\n<h4>List of operating System<\/h4>\n<ul>\n<li> Windows<\/li>\n<li>MACINTOSH<\/li>\n<li>LINUX<\/li>\n<li>UBUNTU<\/li>\n<\/ul>\n<\/body>\n<\/html><\/pre>\n<p>\n<strong><\/strong>輸出:<\/p>\n<p>\n<img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543884158403.png\" alt=\"HTML 顏色?\" ><\/p>\n<p>\n<\/p>有不同的方法來設(shè)定文字顏色,因?yàn)?HTML 有很多可自訂的應(yīng)用程式。 <ul>\n<li>\n<\/li>套用樣式部分<li>\n<\/li>建立單獨(dú)的 CSS 樣式表<li>\n<\/li>換行文字<\/ul>\n<h3>\n<\/h3>如何使用 <style> 應(yīng)用文字顏色部分? <p>\n讓我們來看看使用 HTML 顏色的各種方法:<h4>\n1.使用 HTML 顏色包裹<p>\n下面的程式碼透過簡(jiǎn)單的 HTML 程式碼更改了段落中文字的顏色。有 140 個(gè)彩色名稱可以為網(wǎng)站著色。 <p>\n下面的程式碼示範(fàn)如何使用 <style> 應(yīng)用文字顏色部分。 <p>\n<strong>代碼:<pre><!DOCTYPE html>\n<title> Text color<\/title>\n<html>\n<head>\n<title>HTML BG Color<\/title>\n<\/head>\n<body >\n<h1> changing text color <\/h1>\n<p> This content is very clear <\/p>\n<p style=\"color: pink;\"> pink paragraph text <\/p>\n<\/body>\n<\/html>\n<p>\n<strong>輸出:<p>\n<img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543884223352.png\"\/ alt=\"HTML 顏色?\" ><h4>\n2.使用 HEXCOLOR<p>\n同樣,此範(fàn)例採(cǎi)用樣式部分來宣告十六進(jìn)位顏色,後面接著「#」符號(hào)。 <p>\n<strong>代碼:<pre><!DOCTYPE html>\n<html>\n<head>\n<title> Color Picker<\/title>\n<\/head>\n<body >\n<h1> changing text color? <\/h1>\n<p> hello world <\/p>\n<p style=\"color:#8e47b1\"> Hexa paragraph text <\/p>\n<\/body>\n<\/html>\n<p>\n<strong>輸出:<p>\n<img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543884565656.png\"\/ alt=\"HTML 顏色?\" ><h4>\n3.使用 RGB 顏色<p>\n紅、綠、藍(lán)各使用8位,其值在0到255之間變化,從而產(chǎn)生各種顏色。下面的範(fàn)例根據(jù) RGB 值選擇 RGB 顏色。 <p>\n<strong>代碼:<pre><!DOCTYPE html>\n<html>\n<head>\n<title> Color Picker<\/title>\n<\/head>\n<body>\n<p style=\"color:rgb(0,0,255);\">Blue paragraph text<\/p>\n<\/body>\n<\/html>\n<p>\n<strong>輸出:<p>\n<img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543884782832.png\"\/ alt=\"HTML 顏色?\" ><h4>\n4.使用樣式表的方法<p>\n<strong>代碼:<pre><!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<title> Style Sheet in HTML<\/title>\n<style type=\"text\/css\">\n@import url(\"https:\/\/cdn.educba.com\/examples\/css\/style.css\");\np {\ncolor: green;\nfont-size: 26px;\n}\n<\/style>\n<\/head>\n<body>\n<h1>The styles for Html documents<\/h1>\n<p> Each tag to be styled with colors.<\/p>\n<\/body>\n<\/html>\n<p>\n<strong>輸出:<p>\n<img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543884852266.png\"\/ alt=\"HTML 顏色?\" ><h4>\n5.建立個(gè)人 CSS 樣式<p>\n<strong>代碼:<p>\n<strong>.html 檔案:<pre><!DOCTYPE html>\n<html>\n<head>\n<link rel=\"stylesheet\" type=\"text\/css\" href=\"lcolor.css\">\n<\/head>\n<body>\n<h1>? CSS style sheet<\/h1>\n<p>Multiple HTMl Document.<\/p>\n<p class=\"lcolor\">Hello world!<\/p>\n<\/body>\n<\/html>\n<p>\n<strong>外部 CSS 檔案 lcolor.css:<p>\n<strong>代碼:<pre>.lcolor { font-size: 40px;\ncolor:red }\n<p>\n<strong>輸出:<p>\n<img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543885182059.png\"\/ alt=\"HTML 顏色?\" ><??>\n<h3>How to Set Border Color in HTML?\n<p>It is done using an attribute border color=” “. It is done using the Html element <table> and even we can create 3D effects. The border color is applied using different attributes like border= “width”, bordercolor= “color def”, bordercolorlight=” “. CSS has some enhanced border properties that help in creating borders. The below example shows setting a single border color to the corresponding table. Here <tr> denotes table row and <td> denotes table data and it is started using <table> tag. And the border for them is applied using their width and colors\n<p><strong>Code:\n<pre><!DOCTYPE html>\n<html>\n<head>\n<table border=\"8\" bordercolor=\"Orange\">\n<tr>\n<td>Chicago<\/td>\n<td>new york<\/td>\n<td> Texas<\/td>\n<td> California <\/td>\n<\/tr>\n<\/table> <\/head>\n<\/html>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543885343959.png\"\/ alt=\"HTML 顏色?\" >\n<p>Now let’s see setting two border-color separately. The below code uses table attribute with their elements.\n<p><strong>Code:\n<pre><!DOCTYPE html>\n<html>\n<head>\n<TABLE BORDER=20 BORDERCOLORLIGHT= BLUE BORDERCOLORDARK= ROSE> <TR> <TD> Samsung<\/TD> <TD> Nokia<\/TD> <\/TR> <TR> <TD> Apple Iphone<\/TD> <TD>? Xiami Redmi<\/TD> <\/TR> <\/TABLE>\n<\/head>\n<\/html>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543885747344.png\"\/ alt=\"HTML 顏色?\" >\n<p><strong>Using <div> tag\n<p>It is used to group all the elements and helps in view of a web page at its particular position. In the below code, we have used two <div> one for a paragraph and the other to implement style attribute by setting border pixels and thickness is increased by giving out the width, and we have added padding to demonstrate them to the left.\n<p><strong>Code:\n<pre><!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\" \/>\n<title> Sample border color using div<\/title>\n<\/head>\n<body>\n<div><p> Nature is beautiful<\/p><\/div>\n<div style=\"border:4px dashed #c62d64;padding-left:3px;\"><p> div with a border color.<\/p><\/div>\n<\/body>\n<\/html>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543885835283.png\"\/ alt=\"HTML 顏色?\" >\n<p><strong>Example: This explains how to set the color for padding and margin using class and list tags.\n<p><strong>Code:\n<pre><!DOCTYPE HTML>\n<HTML>\n<HEAD>\n<TITLE>Borders<\/TITLE>\n<STYLE type=\"text\/css\">\nUL {\nbackground: Green;\nmargin: 10px 10px 5px 5px;\npadding: 4px 4px 4px 4px;\n}\nLI {\ncolor: red;\nbackground:yellow;\nmargin: 11px 11px 7px 6px;\npadding: 10px 0px 10px 10px;\nlist-style: none\n}\nLI.colorbord {\nborder-style: dashed;\nborder-width: small;\nborder-color: orange;\n}\n<\/STYLE>\n<\/HEAD>\n<BODY>\n<UL>\n<LI> DOM model\n<li id="377j5v51b"    class=\"colorbord\">Document object model helps in creating document tree\n<\/UL>\n<\/BODY>\n<\/HTML>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543886038363.png\"\/ alt=\"HTML 顏色?\" >\n\n\n<h3>How to Specify Color Using Values in HTML?\n<p>The basic color values vary from 0 to 255 for red, blue, green. The color value is important in giving out lightness.\n<p>The below table shows sample values for the colors.\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543886336443.png\"\/ alt=\"HTML 顏色?\" >\n<p><strong>Example: The below?example shows different color values in their background settings.\n<p><strong>Code:\n<pre><!DOCTYPE html>\n<html>\n<body>\n<p> Data Mining techniques is to understand a patterns<\/p>\n<h1 style=\"background-color:rgb(255, 91, 61);\">Classification<\/h1>\n<h1 style=\"background-color:#e66465;\">Prediction<\/h1>\n<h1 style=\"background-color:hsl(10, 70%, 100%);\"> Regression<\/h1>\n<p>Classification, Prediction techniques<\/p>\n<h1 style=\"background-color:rgba(255, 80, 91, 0.4);\"> HTML colors<\/h1>\n<h1 style=\"background-color:hsla(100%, 9%, 62%, 0.5);\"> Table colors<\/h1>\n<\/body>\n<\/html>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543886550535.png\"\/ alt=\"HTML 顏色?\" >\n<h3>How to use RGB Color Values in HTML?\n<p>RGB denotes Red, Green blue colors directly and uses the RGB function. It takes those three values as parameters and declared them as integers sometimes in percentage. Whichever color we want, its intensity is given a higher value 255 as an integer value falls between o to 255. For instance, to have a blue color, it is preferred to denote (0,0,255). here the first two values are marked as 0,0, and the last value is 255 for blue.\n<p><strong>Example: RGB color\n<p><strong>Code:\n<pre><!DOCTYPE html>\n<html>\n<style>\ndiv {\nbackground-color: rgb(255, 0, 180);\ncolor: rgb(0, 255, 255);\npadding: 30px;\n}\n<\/style>\n<body>\n<div>\n<h1>Norway the most beautiful place it’s a Scandinavian Country. <\/h1>\n<p> It is the most expensive country in the world, Oslo is the capital of this green city. <\/p>\n<\/div>\n<\/body>\n<\/html>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543886761776.png\"\/ alt=\"HTML 顏色?\" >\n<h3>How to Specify the Lightness of Colors in HTML?\n<p>The lightness of color is defined by the brightness we prefer; it is measured in percentage. Most web designers wish to use lightness than RGB, which can be adjusted as per the requirements. Here a black set the brightness to 0% white set to 100%. It is specified using function hsl().\n<p><strong>Code:\n<pre><!DOCTYPE html>\n<html>\n<style>\ndiv {\nbackground-color: hsl(150, 50%, 60%);\ncolor: hsl(100%, 0%, 0%);\npadding: 30px;\n}\n<\/style>\n<body>\n<div>\n<h1>Norway the most beautiful place its an Scandinavian Country.<\/h1>\n<p>It is the most expensive country in the world, Oslo is the capital of this green city.<\/p>\n<\/div>\n<\/body>\n<\/html>\n<p><strong>Output:\n<p><img  src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/000\/172543886988457.png\"\/ alt=\"HTML 顏色?\" >\n<p>You can try with different values for color in the above example.\n<h3>Conclusion – HTML Colors\n<p>Therefore, to conclude, we have seen that this has different properties. In earlier days, web development has many ways to specify colors for their website, and nowadays, the most popular colorways are RGB and Hex color codes (RGB is well-known). There are different applications where colors are implemented, like a sliding scale, color palette, etc.<\/style>"}	</script>
    	
    <meta http-equiv="Cache-Control" content="no-transform" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <script>var V_PATH="/";window.onerror=function(){ return true; };</script>
    </head>
    
    <body data-commit-time="2023-12-28T14:50:12+08:00" class="editor_body body2_2">
    	<link rel="stylesheet" type="text/css" href="/static/csshw/stylehw.css">
    <header>
        <div   id="377j5v51b"   class="head">
            <div   id="377j5v51b"   class="haed_left">
                <div   id="377j5v51b"   class="haed_logo">
                    <a href="http://m.miracleart.cn/zh-tw/" title="" class="haed_logo_a">
                        <img src="/static/imghw/logo.png" alt="" class="haed_logoimg">
                    </a>
                </div>
                <div   id="377j5v51b"   class="head_nav">
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="javascript:;" title="社群" class="head_nava head_nava-template1">社群</a>
                        <div   class="377j5v51b"   id="dropdown-template1" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://m.miracleart.cn/zh-tw/article.html" title="文章" class="languagechoosea on">文章</a>
                                <a href="http://m.miracleart.cn/zh-tw/faq/zt" title="合集" class="languagechoosea">合集</a>
                                <a href="http://m.miracleart.cn/zh-tw/wenda.html" title="問答" class="languagechoosea">問答</a>
                            </div>
                        </div>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="javascript:;" title="學(xué)習(xí)" class="head_nava head_nava-template1_1">學(xué)習(xí)</a>
                        <div   class="377j5v51b"   id="dropdown-template1_1" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://m.miracleart.cn/zh-tw/course.html" title="課程" class="languagechoosea on">課程</a>
                                <a href="http://m.miracleart.cn/zh-tw/dic/" title="程式設(shè)計(jì)字典" class="languagechoosea">程式設(shè)計(jì)字典</a>
                            </div>
                        </div>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="javascript:;" title="工具庫(kù)" class="head_nava head_nava-template1_2">工具庫(kù)</a>
                        <div   class="377j5v51b"   id="dropdown-template1_2" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://m.miracleart.cn/zh-tw/toolset/development-tools" title="開發(fā)工具" class="languagechoosea on">開發(fā)工具</a>
                                <a href="http://m.miracleart.cn/zh-tw/toolset/website-source-code" title="網(wǎng)站源碼" class="languagechoosea">網(wǎng)站源碼</a>
                                <a href="http://m.miracleart.cn/zh-tw/toolset/php-libraries" title="PHP 函式庫(kù)" class="languagechoosea">PHP 函式庫(kù)</a>
                                <a href="http://m.miracleart.cn/zh-tw/toolset/js-special-effects" title="JS特效" class="languagechoosea on">JS特效</a>
                                <a href="http://m.miracleart.cn/zh-tw/toolset/website-materials" title="網(wǎng)站素材" class="languagechoosea on">網(wǎng)站素材</a>
                                <a href="http://m.miracleart.cn/zh-tw/toolset/extension-plug-ins" title="擴(kuò)充插件" class="languagechoosea on">擴(kuò)充插件</a>
                            </div>
                        </div>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="http://m.miracleart.cn/zh-tw/ai" title="AI工具" class="head_nava head_nava-template1_3">AI工具</a>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="javascript:;" title="休閒" class="head_nava head_nava-template1_3">休閒</a>
                        <div   class="377j5v51b"   id="dropdown-template1_3" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://m.miracleart.cn/zh-tw/game" title="遊戲下載" class="languagechoosea on">遊戲下載</a>
                                <a href="http://m.miracleart.cn/zh-tw/mobile-game-tutorial/" title="遊戲教程" class="languagechoosea">遊戲教程</a>
    
                            </div>
                        </div>
                    </div>
                </div>
            </div>
                        <div   id="377j5v51b"   class="head_search">
                    <input id="key_words"  onkeydown="if (event.keyCode == 13) searchs('zh-tw')" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="">
                    <a href="javascript:;" title="搜尋"  onclick="searchs('zh-tw')"><img src="/static/imghw/find.png" alt="搜尋"></a>
                </div>
                    <div   id="377j5v51b"   class="head_right">
                <div   id="377j5v51b"   class="haed_language">
                    <a href="javascript:;" class="layui-btn haed_language_btn">繁體中文<i class="layui-icon layui-icon-triangle-d"></i></a>
                    <div   class="377j5v51b"   id="dropdown-template" style="display: none;">
                        <div   id="377j5v51b"   class="languagechoose">
                                                    <a href="javascript:setlang('zh-cn');" title="簡(jiǎn)體中文" class="languagechoosea">簡(jiǎn)體中文</a>
                                                    <a href="javascript:setlang('en');" title="English" class="languagechoosea">English</a>
                                                    <a href="javascript:;" title="繁體中文" class="languagechoosea">繁體中文</a>
                                                    <a href="javascript:setlang('ja');" title="日本語" class="languagechoosea">日本語</a>
                                                    <a href="javascript:setlang('ko');" title="???" class="languagechoosea">???</a>
                                                    <a href="javascript:setlang('ms');" title="Melayu" class="languagechoosea">Melayu</a>
                                                    <a href="javascript:setlang('fr');" title="Fran?ais" class="languagechoosea">Fran?ais</a>
                                                    <a href="javascript:setlang('de');" title="Deutsch" class="languagechoosea">Deutsch</a>
                                                </div>
                    </div>
                </div>
                <span id="377j5v51b"    class="head_right_line"></span>
                                <div style="display: block;" id="login" class="haed_login ">
                        <a href="javascript:;"  title="Login" class="haed_logina ">Login</a>
                    </div>
                    <div style="display: block;" id="reg" class="head_signup login">
                        <a href="javascript:;"  title="singup" class="head_signupa">singup</a>
                    </div>
                
            </div>
        </div>
    </header>
    
    	
    	<main>
    		<div   id="377j5v51b"   class="Article_Details_main">
    			<div   id="377j5v51b"   class="Article_Details_main1">
    							<div   id="377j5v51b"   class="Article_Details_main1L">
    					<div   id="377j5v51b"   class="Article_Details_main1Lmain" id="Article_Details_main1Lmain">
    						<div   id="377j5v51b"   class="Article_Details_main1L1">目錄</div>
    						<div   id="377j5v51b"   class="Article_Details_main1L2" id="Article_Details_main1L2">
    							<!-- 左側(cè)懸浮,文章定位標(biāo)題1 id="Article_Details_main1L2s_1"-->
    															<div   id="377j5v51b"   class="Article_Details_main1L2s ">
    									<a href="#如何在-HTML-中設(shè)定背景顏色" title="如何在 HTML 中設(shè)定背景顏色? " >如何在 HTML 中設(shè)定背景顏色? </a>
    								</div>
    														</div>
    					</div>
    				</div>
    							<div   id="377j5v51b"   class="Article_Details_main1M">
    					<div   id="377j5v51b"   class="phpgenera_Details_mainL1">
    						<a href="http://m.miracleart.cn/zh-tw/" title="首頁(yè)"
    							class="phpgenera_Details_mainL1a">首頁(yè)</a>
    						<img src="/static/imghw/top_right.png" alt="" />
    												<a href="http://m.miracleart.cn/zh-tw/web-designer.html"
    							class="phpgenera_Details_mainL1a">web前端</a>
    						<img src="/static/imghw/top_right.png" alt="" />
    												<a href="http://m.miracleart.cn/zh-tw/div-tutorial.html"
    							class="phpgenera_Details_mainL1a">html教學(xué)</a>
    						<img src="/static/imghw/top_right.png" alt="" />
    						<span>HTML 顏色?</span>
    					</div>
    					
    					<div   id="377j5v51b"   class="Articlelist_txts">
    						<div   id="377j5v51b"   class="Articlelist_txts_info">
    							<h1 class="Articlelist_txts_title">HTML 顏色?</h1>
    							<div   id="377j5v51b"   class="Articlelist_txts_info_head">
    								<div   id="377j5v51b"   class="author_info">
    									<a href="http://m.miracleart.cn/zh-tw/member/465014.html"  class="author_avatar">
    									<img class="lazy"  data-src="https://img.php.cn/upload/avatar/000/465/014/627b58ba8fa6c600.jpg" src="/static/imghw/default1.png" alt="王林">
    									</a>
    									<div   id="377j5v51b"   class="author_detail">
    																			<a href="http://m.miracleart.cn/zh-tw/member/465014.html" class="author_name">王林</a>
                                    										</div>
    								</div>
                    			</div>
    							<span id="377j5v51b"    class="Articlelist_txts_time">Sep 04, 2024 pm	 04:33 PM</span>
    															<div   id="377j5v51b"   class="Articlelist_txts_infos">
    																			<span id="377j5v51b"    class="Articlelist_txts_infoss on">html</span>
    																			<span id="377j5v51b"    class="Articlelist_txts_infoss ">html5</span>
    																			<span id="377j5v51b"    class="Articlelist_txts_infoss ">HTML Tutorial</span>
    																			<span id="377j5v51b"    class="Articlelist_txts_infoss ">HTML Properties</span>
    																			<span id="377j5v51b"    class="Articlelist_txts_infoss ">HTML tags</span>
    																	</div>
    														
    						</div>
    					</div>
    					<hr />
    					<div   id="377j5v51b"   class="article_main php-article">
    						<div   id="377j5v51b"   class="article-list-left detail-content-wrap content">
    						<ins class="adsbygoogle"
    							style="display:block; text-align:center;"
    							data-ad-layout="in-article"
    							data-ad-format="fluid"
    							data-ad-client="ca-pub-5902227090019525"
    							data-ad-slot="3461856641">
    						</ins>
    						
    
    					<p>本文介紹如何使用 HTML 以簡(jiǎn)單易行的方式在網(wǎng)站中使用顏色。顏色在創(chuàng)建網(wǎng)站的外觀和感覺方面發(fā)揮著重要作用。 HTML 中沒有單獨(dú)的標(biāo)籤;相反,它使用樣式屬性或顏色屬性。準(zhǔn)確地說,顏色是使用層疊樣式表 (CSS) 嵌入到 HTML 元素中的。顏色賦予網(wǎng)頁(yè)優(yōu)雅的外觀。為網(wǎng)頁(yè)新增顏色包括設(shè)定背景顏色、表格、段落等</p>
    <h3 id="如何在-HTML-中設(shè)定背景顏色">如何在 HTML 中設(shè)定背景顏色? </h3>
    <p>讓背景顏色變亮使網(wǎng)站看起來更漂亮、更大膽。它是透過使用顏色、十六進(jìn)制顏色代碼來完成的。 RGB 和 RGBA 顏色值(Alpha 值 0 到 1)。 </p>
    
    
    
    
    
    
    
    
    <p>使用 Html body 元素內(nèi)的 Style 屬性將十六進(jìn)位顏色直接套用於 Html 程式碼。十六進(jìn)制是數(shù)字和字母的組合。以下是網(wǎng)頁(yè)背景顏色的範(fàn)例。 </p>
    <p><strong>代碼:</strong></p>
    <pre class="brush:php;toolbar:false"><!DOCTYPE html>
    <title>My Sample</title>
    <html>
    <head>
    <title>HTML BG Color</title>
    </head>
    <body style="background-color:red;">
    <h1> This page is a demo </h1>
    </body>
    </html></pre>
    <p><strong>程式碼片段:</strong></p>
    <p><img  src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/172543883915222.png" class="lazy" alt="HTML 顏色?" ></p>
    <p>要新增背景顏色,可以使用 bgcolor 屬性來顯示 </p> body bgcolor=''>.它與除 HTML 5 之外的所有瀏覽器相容。 <p>
    <strong></strong>代碼:</p>
    <pre class="brush:php;toolbar:false"><h3 style="color: blue">Color Name</h3>
    <h3 style="color: #0000ff">Hexadecimal</h3>
    <h3 style="color: rgb (0,0,255)">RGB Value</h3></pre>
    <h3>
    </h3>如何為 HTML 中的文字套用顏色? <p>
    </p>對(duì) HTML 文字套用顏色非常簡(jiǎn)單;我們可以透過三種方式添加/更改文字的顏色,即十六進(jìn)位顏色、HSL 值和顏色名稱。以下是將顏色應(yīng)用到對(duì)應(yīng)網(wǎng)頁(yè)的三種不同技術(shù)。 <h4>
    </h4>1.顏色名稱<p>
    </p>當(dāng)應(yīng)用程式直接使用這些顏色名稱時(shí),使用英文顏色名稱非常簡(jiǎn)單。指定顏色名稱是直接方法,W3C已經(jīng)公佈了16種基本顏色(黑色、黃色、紅色、栗色、灰色、石灰、綠色、橄欖色、銀色、水色、藍(lán)色、海軍藍(lán)、白色、紫色、紫紅色、青色)<h4>
    
    
    </h4>2.福勝利<p>
    </p>色相飽和度和亮度顏色值。色調(diào)定義為 0 到 360 度,飽和度和亮度定義為 0 到 100 %。 <h4>
    </h4>3.十六進(jìn)位顏色<p>
    </p>為了得到精確的結(jié)果,應(yīng)用六位十六進(jìn)位數(shù)。詳細(xì)來說,前兩位表示紅色,後兩位表示綠色,另外兩位表示藍(lán)色值,前面有「#」。 <p>
    </p>以下範(fàn)例解釋了向文件應(yīng)用顏色的不同方法。 <p>
    <strong></strong>代碼:</p>
    <pre class="brush:php;toolbar:false"><head>
    <title>EDUCBA</title>
    <style type="text/css">
    h1{
    color:#97cae0;
    background-color: hsl(200, 50%, 20%);
    color: hsl(200, 20%, 90%);
    }
    h4{
    color:rgb(0, 255, 0);
    background-color: hsl(130, 10%, 30%);
    color: hsl(280, 20%, 80%);
    }
    li{
    color:rgba(12, 88, 120, 1);
    background-color: hsl(210, 36%, 50%);
    color: hsl(145, 45%, 81%);
    }
    </style>
    </head>
    <body>
    <h1>EDUCBA</h1>
    <h4>List of operating System</h4>
    <ul>
    <li> Windows</li>
    <li>MACINTOSH</li>
    <li>LINUX</li>
    <li>UBUNTU</li>
    </ul>
    </body>
    </html></pre>
    <p>
    <strong></strong>輸出:</p>
    <p>
    <img  src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/000/172543884158403.png" class="lazy" alt="HTML 顏色?" ></p>
    <p>
    </p>有不同的方法來設(shè)定文字顏色,因?yàn)?HTML 有很多可自訂的應(yīng)用程式。 <ul>
    <li>
    </li>套用樣式部分<li>
    </li>建立單獨(dú)的 CSS 樣式表<li>
    </li>換行文字</ul>
    <h3>
    </h3>如何使用 <style> 應(yīng)用文字顏色部分? <p>
    讓我們來看看使用 HTML 顏色的各種方法:<h4>
    1.使用 HTML 顏色包裹<p>
    下面的程式碼透過簡(jiǎn)單的 HTML 程式碼更改了段落中文字的顏色。有 140 個(gè)彩色名稱可以為網(wǎng)站著色。 <p>
    下面的程式碼示範(fàn)如何使用 <style> 應(yīng)用文字顏色部分。 <p>
    <strong>代碼:<pre class="brush:php;toolbar:false"><!DOCTYPE html>
    <title> Text color
    
    
    HTML BG Color
    
    
    

    changing text color

    This content is very clear

    pink paragraph text

    輸出:

    HTML 顏色?

    2.使用 HEXCOLOR

    同樣,此範(fàn)例採(cǎi)用樣式部分來宣告十六進(jìn)位顏色,後面接著「#」符號(hào)。

    代碼:

    
    
    
     Color Picker
    
    
    

    changing text color?

    hello world

    Hexa paragraph text

    輸出:

    HTML 顏色?

    3.使用 RGB 顏色

    紅、綠、藍(lán)各使用8位,其值在0到255之間變化,從而產(chǎn)生各種顏色。下面的範(fàn)例根據(jù) RGB 值選擇 RGB 顏色。

    代碼:

    
    
    
     Color Picker
    
    
    

    Blue paragraph text

    輸出:

    HTML 顏色?

    4.使用樣式表的方法

    代碼:

    
    
    
    
     Style Sheet in HTML
    
    
    
    

    The styles for Html documents

    Each tag to be styled with colors.

    輸出:

    HTML 顏色?

    5.建立個(gè)人 CSS 樣式

    代碼:

    .html 檔案:

    
    
    
    
    
    
    

    ? CSS style sheet

    Multiple HTMl Document.

    Hello world!

    外部 CSS 檔案 lcolor.css:

    代碼:

    .lcolor { font-size: 40px;
    color:red }
    

    輸出:

    HTML 顏色?

    How to Set Border Color in HTML?

    It is done using an attribute border color=” “. It is done using the Html element

    and even we can create 3D effects. The border color is applied using different attributes like border= “width”, bordercolor= “color def”, bordercolorlight=” “. CSS has some enhanced border properties that help in creating borders. The below example shows setting a single border color to the corresponding table. Here denotes table row and
        denotes table data and it is started using tag. And the border for them is applied using their width and colors

        Code:

        
        
        
        
        Chicago new york Texas California

        Output:

        HTML 顏色?

        Now let’s see setting two border-color separately. The below code uses table attribute with their elements.

        Code:

        
        
        
        
        Samsung Nokia
        Apple Iphone ? Xiami Redmi

        Output:

        HTML 顏色?

        Using

        tag

        It is used to group all the elements and helps in view of a web page at its particular position. In the below code, we have used two

        one for a paragraph and the other to implement style attribute by setting border pixels and thickness is increased by giving out the width, and we have added padding to demonstrate them to the left.

        Code:

        
        
        
        
         Sample border color using div
        
        
        

        Nature is beautiful

        div with a border color.

        Output:

        HTML 顏色?

        Example: This explains how to set the color for padding and margin using class and list tags.

        Code:

        
        
        
        Borders
        
        
        
        
        • DOM model
        • Document object model helps in creating document tree

        Output:

        HTML 顏色?

        How to Specify Color Using Values in HTML?

        The basic color values vary from 0 to 255 for red, blue, green. The color value is important in giving out lightness.

        The below table shows sample values for the colors.

        HTML 顏色?

        Example: The below?example shows different color values in their background settings.

        Code:

        
        
        
        

        Data Mining techniques is to understand a patterns

        Classification

        Prediction

        Regression

        Classification, Prediction techniques

        HTML colors

        Table colors

        Output:

        HTML 顏色?

        How to use RGB Color Values in HTML?

        RGB denotes Red, Green blue colors directly and uses the RGB function. It takes those three values as parameters and declared them as integers sometimes in percentage. Whichever color we want, its intensity is given a higher value 255 as an integer value falls between o to 255. For instance, to have a blue color, it is preferred to denote (0,0,255). here the first two values are marked as 0,0, and the last value is 255 for blue.

        Example: RGB color

        Code:

        
        
        
        
        

        Norway the most beautiful place it’s a Scandinavian Country.

        It is the most expensive country in the world, Oslo is the capital of this green city.

        Output:

        HTML 顏色?

        How to Specify the Lightness of Colors in HTML?

        The lightness of color is defined by the brightness we prefer; it is measured in percentage. Most web designers wish to use lightness than RGB, which can be adjusted as per the requirements. Here a black set the brightness to 0% white set to 100%. It is specified using function hsl().

        Code:

        
        
        
        
        

        Norway the most beautiful place its an Scandinavian Country.

        It is the most expensive country in the world, Oslo is the capital of this green city.

        Output:

        HTML 顏色?

        You can try with different values for color in the above example.

        Conclusion – HTML Colors

        Therefore, to conclude, we have seen that this has different properties. In earlier days, web development has many ways to specify colors for their website, and nowadays, the most popular colorways are RGB and Hex color codes (RGB is well-known). There are different applications where colors are implemented, like a sliding scale, color palette, etc.

        以上是HTML 顏色?的詳細(xì)內(nèi)容。更多資訊請(qǐng)關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

        本網(wǎng)站聲明
        本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請(qǐng)聯(lián)絡(luò)admin@php.cn

        熱AI工具

        Undress AI Tool

        Undress AI Tool

        免費(fèi)脫衣圖片

        Undresser.AI Undress

        Undresser.AI Undress

        人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

        AI Clothes Remover

        AI Clothes Remover

        用於從照片中去除衣服的線上人工智慧工具。

        Clothoff.io

        Clothoff.io

        AI脫衣器

        Video Face Swap

        Video Face Swap

        使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

        熱工具

        記事本++7.3.1

        記事本++7.3.1

        好用且免費(fèi)的程式碼編輯器

        SublimeText3漢化版

        SublimeText3漢化版

        中文版,非常好用

        禪工作室 13.0.1

        禪工作室 13.0.1

        強(qiáng)大的PHP整合開發(fā)環(huán)境

        Dreamweaver CS6

        Dreamweaver CS6

        視覺化網(wǎng)頁(yè)開發(fā)工具

        SublimeText3 Mac版

        SublimeText3 Mac版

        神級(jí)程式碼編輯軟體(SublimeText3)

        將CSS和JavaScript與HTML5結(jié)構(gòu)有效整合。 將CSS和JavaScript與HTML5結(jié)構(gòu)有效整合。 Jul 12, 2025 am 03:01 AM

        HTML5、CSS和JavaScript應(yīng)通過語義化標(biāo)籤、合理加載順序與解耦設(shè)計(jì)高效結(jié)合。 1.使用HTML5語義化標(biāo)籤如、提升結(jié)構(gòu)清晰度與可維護(hù)性,利於SEO和無障礙訪問;2.CSS應(yīng)置於中,使用外部文件並按模塊拆分,避免內(nèi)聯(lián)樣式與延遲加載問題;3.JavaScript推薦放在前引入,使用defer或async異步加載以避免阻塞渲染;4.減少三者間強(qiáng)依賴,通過data-*屬性驅(qū)動(dòng)行為、類名控制狀態(tài),統(tǒng)一命名規(guī)範(fàn)提升協(xié)作效率。這些方法能有效優(yōu)化頁(yè)面性能與團(tuán)隊(duì)協(xié)作。

        使用HTML按鈕元素實(shí)現(xiàn)可點(diǎn)擊按鈕 使用HTML按鈕元素實(shí)現(xiàn)可點(diǎn)擊按鈕 Jul 07, 2025 am 02:31 AM

        要使用HTML的button元素實(shí)現(xiàn)可點(diǎn)擊按鈕,首先需掌握其基本用法與常見註意事項(xiàng)。 1.使用標(biāo)籤創(chuàng)建按鈕,並通過type屬性定義行為(如button、submit、reset),默認(rèn)為submit;2.通過JavaScript添加交互功能,可內(nèi)聯(lián)寫法或通過ID綁定事件監(jiān)聽器以提升維護(hù)性;3.利用CSS自定義樣式,包括背景色、邊框、圓角及hover/active狀態(tài)效果,增強(qiáng)用戶體驗(yàn);4.注意常見問題:確保未啟用disabled屬性、正確綁定JS事件、避免佈局遮擋,並藉助開發(fā)者工具排查異常。掌握這

        在HTML頭部元素中配置文檔元數(shù)據(jù) 在HTML頭部元素中配置文檔元數(shù)據(jù) Jul 09, 2025 am 02:30 AM

        HTMLhead中的元數(shù)據(jù)對(duì)SEO、社交分享和瀏覽器行為至關(guān)重要。 1.設(shè)置頁(yè)面標(biāo)題與描述,使用和並保持簡(jiǎn)潔唯一;2.添加OpenGraph與Twitter卡片信息以優(yōu)化社交分享效果,注意圖片尺寸並使用調(diào)試工具測(cè)試;3.定義字符集與視口設(shè)置確保多語言支持與移動(dòng)端適配;4.可選標(biāo)籤如作者版權(quán)、robots控制及canonical防止重複內(nèi)容也應(yīng)合理配置。

        解釋html5`  vs` '元素。 解釋html5` vs` '元素。 Jul 12, 2025 am 03:09 AM

        是塊級(jí)元素,適合佈局;是內(nèi)聯(lián)元素,適合包裹文字內(nèi)容。 1.獨(dú)占一行,可設(shè)置寬高和邊距,常用於結(jié)構(gòu)佈局;2.不換行,大小由內(nèi)容決定,適用於局部文本樣式或動(dòng)態(tài)操作;3.選擇時(shí)應(yīng)根據(jù)內(nèi)容是否需獨(dú)立空間判斷;4.不可嵌套在內(nèi),不適合做佈局;5.優(yōu)先使用語義化標(biāo)籤以提升結(jié)構(gòu)清晰度與可訪問性。

        使用新的HTML5方法(FormData)提交表單數(shù)據(jù) 使用新的HTML5方法(FormData)提交表單數(shù)據(jù) Jul 08, 2025 am 02:28 AM

        使用HTML5的FormDataAPI提交表單數(shù)據(jù)更方便,1.它可自動(dòng)收集帶name屬性的表單字段或手動(dòng)添加數(shù)據(jù);2.支持通過fetch或XMLHttpRequest以multipart/form-data格式提交,適合文件上傳;3.處理文件時(shí)只需將文件附加到FormData並發(fā)送請(qǐng)求即可;4.注意同名字段會(huì)被覆蓋、需處理JSON轉(zhuǎn)換及無嵌套結(jié)構(gòu)等問題。

        了解HTML5媒體源擴(kuò)展(MSE) 了解HTML5媒體源擴(kuò)展(MSE) Jul 08, 2025 am 02:31 AM

        MSE(MediaSourceExtensions)是W3C標(biāo)準(zhǔn)的一部分,允許JavaScript動(dòng)態(tài)構(gòu)建媒體流,從而實(shí)現(xiàn)高級(jí)視頻播放功能。它通過MediaSource管理媒體源、SourceBuffer存放數(shù)據(jù)、TimeRanges表示緩衝時(shí)間範(fàn)圍,使瀏覽器能動(dòng)態(tài)加載並解碼視頻片段。使用MSE的流程包括:①創(chuàng)建MediaSource實(shí)例;②將其綁定到元素;③添加SourceBuffer接收特定格式數(shù)據(jù);④通過fetch()獲取分段數(shù)據(jù)並追加至緩衝區(qū)。常見註意事項(xiàng)有:①格式兼容性問題;②時(shí)間戳對(duì)

        用HTML5` 標(biāo)籤顯示進(jìn)度條。 用HTML5` 標(biāo)籤顯示進(jìn)度條。 Jul 08, 2025 am 02:24 AM

        HTML5的標(biāo)籤可直接實(shí)現(xiàn)網(wǎng)頁(yè)進(jìn)度條。 1.基本用法是設(shè)置value和max屬性,如顯示30%進(jìn)度;2.若進(jìn)度未知可省略value,僅設(shè)max,如表示不確定狀態(tài);3.可通過CSS自定義樣式,需處理瀏覽器兼容性;4.常用於上傳文件、表單進(jìn)度、遊戲加載等場(chǎng)景;5.注意避免任務(wù)過快完成時(shí)使用,並考慮舊版IE的兼容問題。

        如何使用HTML圖和Figcaption元素將字幕與圖像或媒體關(guān)聯(lián)? 如何使用HTML圖和Figcaption元素將字幕與圖像或媒體關(guān)聯(lián)? Jul 07, 2025 am 02:30 AM

        使用HTML的和可以直觀且語義清晰地為圖片或媒體添加說明文字。 1.用於包裹獨(dú)立的媒體內(nèi)容,如圖片、視頻或代碼塊;2.則作為其說明文字,置於內(nèi)部,可位於媒體上方或下方;3.它們不僅提升頁(yè)面結(jié)構(gòu)清晰度,還增強(qiáng)可訪問性和SEO效果;4.使用時(shí)應(yīng)注意避免濫用,適用於需強(qiáng)調(diào)並附帶說明的內(nèi)容,而非普通裝飾圖;5.不可忽視的alt屬性,它與figcaption的作用不同;6.figcaption位置靈活,可根據(jù)需要放在figure內(nèi)頂部或底部。正確使用這兩個(gè)標(biāo)籤,有助於構(gòu)建語義清晰、易於理解的網(wǎng)頁(yè)內(nèi)容。

        See all articles