• <strike id="sg0is"></strike>
  • <ul id="sg0is"><center id="sg0is"></center></ul>
    \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>對 HTML 文本應用顏色非常簡單;我們可以通過三種方式添加\/更改文本的顏色,即十六進制顏色、HSL 值和顏色名稱。以下是向相應網(wǎng)頁應用顏色的三種不同技術。

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

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

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

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

    \n<\/h4>3.十六進制顏色

    \n<\/p>為了獲得精確的結果,使用六位十六進制數(shù)。詳細來說,前兩位表示紅色,后兩位表示綠色,另外兩位表示藍色值,前面帶有‘#’。

    \n<\/p>以下示例說明了向文檔應用顏色的不同方法。

    \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://www.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>有不同的方法來設置文本顏色,因為 HTML 有很多可定制的應用程序。<ul>\n<li>\n<\/li>應用樣式部分<li>\n<\/li>創(chuàng)建單獨的 CSS 樣式表<li>\n<\/li>換行文本<\/ul>\n<h3>\n<\/h3>如何使用 <style> 應用文本顏色部分?<p>\n讓我們看看使用 HTML 顏色的各種方法:<h4>\n1.使用 HTML 顏色包裹<p>\n下面的代碼通過簡單的 HTML 代碼更改了段落中文本的顏色。有 140 個彩色名稱可以為網(wǎng)站著色。<p>\n下面的代碼演示了如何使用 <style> 應用文本顏色部分。<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同樣,此示例采用樣式部分來聲明十六進制顏色,后跟“#”符號。<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紅、綠、藍各使用8位,其值在0到255之間變化,從而產(chǎ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.創(chuàng)建個人 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://www.miracleart.cn/zh/" 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="社區(qū)" class="head_nava head_nava-template1">社區(qū)</a>
                        <div   class="377j5v51b"   id="dropdown-template1" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://www.miracleart.cn/zh/article.html" title="文章" class="languagechoosea on">文章</a>
                                <a href="http://www.miracleart.cn/zh/faq/zt" title="合集" class="languagechoosea">合集</a>
                                <a href="http://www.miracleart.cn/zh/wenda.html" title="問答" class="languagechoosea">問答</a>
                            </div>
                        </div>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="javascript:;" title="學習" class="head_nava head_nava-template1_1">學習</a>
                        <div   class="377j5v51b"   id="dropdown-template1_1" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://www.miracleart.cn/zh/course.html" title="課程" class="languagechoosea on">課程</a>
                                <a href="http://www.miracleart.cn/zh/dic/" title="編程詞典" class="languagechoosea">編程詞典</a>
                            </div>
                        </div>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="javascript:;" title="工具庫" class="head_nava head_nava-template1_2">工具庫</a>
                        <div   class="377j5v51b"   id="dropdown-template1_2" style="display: none;">
                            <div   id="377j5v51b"   class="languagechoose">
                                <a href="http://www.miracleart.cn/zh/toolset/development-tools" title="開發(fā)工具" class="languagechoosea on">開發(fā)工具</a>
                                <a href="http://www.miracleart.cn/zh/toolset/website-source-code" title="網(wǎng)站源碼" class="languagechoosea">網(wǎng)站源碼</a>
                                <a href="http://www.miracleart.cn/zh/toolset/php-libraries" title="PHP 庫" class="languagechoosea">PHP 庫</a>
                                <a href="http://www.miracleart.cn/zh/toolset/js-special-effects" title="JS特效" class="languagechoosea on">JS特效</a>
                                <a href="http://www.miracleart.cn/zh/toolset/website-materials" title="網(wǎng)站素材" class="languagechoosea on">網(wǎng)站素材</a>
                                <a href="http://www.miracleart.cn/zh/toolset/extension-plug-ins" title="擴展插件" class="languagechoosea on">擴展插件</a>
                            </div>
                        </div>
                    </div>
    
                    <div   id="377j5v51b"   class="head_navs">
                        <a href="http://www.miracleart.cn/zh/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://www.miracleart.cn/zh/game" title="游戲下載" class="languagechoosea on">游戲下載</a>
                                <a href="http://www.miracleart.cn/zh/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')" class="search-input" type="text" autocomplete="off" name="keywords" required="required" placeholder="Block,address,transaction,news" value="">
                    <a href="javascript:;" title="搜索"  onclick="searchs('zh')"><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:;" title="簡體中文" class="languagechoosea">簡體中文</a>
                                                    <a href="javascript:setlang('en');" title="English" class="languagechoosea">English</a>
                                                    <a href="javascript:setlang('zh-tw');" 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">
    							<!-- 左側懸浮,文章定位標題1 id="Article_Details_main1L2s_1"-->
    															<div   id="377j5v51b"   class="Article_Details_main1L2s ">
    									<a href="#如何在-HTML-中設置背景顏色" title="如何在 HTML 中設置背景顏色?" >如何在 HTML 中設置背景顏色?</a>
    								</div>
    														</div>
    					</div>
    				</div>
    							<div   id="377j5v51b"   class="Article_Details_main1M">
    					<div   id="377j5v51b"   class="phpgenera_Details_mainL1">
    						<a href="http://www.miracleart.cn/zh/" title="首頁"
    							class="phpgenera_Details_mainL1a">首頁</a>
    						<img src="/static/imghw/top_right.png" alt="" />
    												<a href="http://www.miracleart.cn/zh/web-designer.html"
    							class="phpgenera_Details_mainL1a">web前端</a>
    						<img src="/static/imghw/top_right.png" alt="" />
    												<a href="http://www.miracleart.cn/zh/div-tutorial.html"
    							class="phpgenera_Details_mainL1a">html教程</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://www.miracleart.cn/zh/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://www.miracleart.cn/zh/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 以簡單易行的方式在網(wǎng)站中使用顏色。顏色在創(chuàng)建網(wǎng)站的外觀和感覺方面發(fā)揮著重要作用。 HTML 中沒有單獨的標簽;相反,它使用樣式屬性或顏色屬性。準確地說,顏色是使用層疊樣式表 (CSS) 嵌入到 HTML 元素中的。顏色賦予網(wǎng)頁優(yōu)雅的外觀。為網(wǎng)頁添加顏色包括設置背景顏色、表格、段落等</p>
    <h3 id="如何在-HTML-中設置背景顏色">如何在 HTML 中設置背景顏色?</h3>
    <p>使背景顏色變亮使網(wǎng)站看起來更漂亮、更大膽。它是通過使用顏色、十六進制顏色代碼來完成的。 RGB 和 RGBA 顏色值(Alpha 值 0 到 1)。</p>
    
    
    
    
    
    
    
    
    <p>使用 Html body 元素內(nèi)的 Style 屬性將十六進制顏色直接應用于 Html 代碼。十六進制是數(shù)字和字母的組合。以下是網(wǎng)頁背景顏色的示例。</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>對 HTML 文本應用顏色非常簡單;我們可以通過三種方式添加/更改文本的顏色,即十六進制顏色、HSL 值和顏色名稱。以下是向相應網(wǎng)頁應用顏色的三種不同技術。<h4>
    </h4>1.顏色名稱<p>
    </p>當應用程序直接使用這些顏色名稱時,使用英文顏色名稱非常簡單。指定顏色名稱是直接方法,W3C已經(jīng)公布了16種基本顏色(黑色、黃色、紅色、栗色、灰色、石灰、綠色、橄欖色、銀色、水色、藍色、海軍藍、白色、紫色、紫紅色、青色)<h4>
    
    
    </h4>2.福勝利<p>
    </p>色相飽和度和亮度顏色值。色調(diào)定義為 0 到 360 度,飽和度和亮度定義為 0 到 100 %。<h4>
    </h4>3.十六進制顏色<p>
    </p>為了獲得精確的結果,使用六位十六進制數(shù)。詳細來說,前兩位表示紅色,后兩位表示綠色,另外兩位表示藍色值,前面帶有‘#’。<p>
    </p>以下示例說明了向文檔應用顏色的不同方法。<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>有不同的方法來設置文本顏色,因為 HTML 有很多可定制的應用程序。<ul>
    <li>
    </li>應用樣式部分<li>
    </li>創(chuàng)建單獨的 CSS 樣式表<li>
    </li>換行文本</ul>
    <h3>
    </h3>如何使用 <style> 應用文本顏色部分?<p>
    讓我們看看使用 HTML 顏色的各種方法:<h4>
    1.使用 HTML 顏色包裹<p>
    下面的代碼通過簡單的 HTML 代碼更改了段落中文本的顏色。有 140 個彩色名稱可以為網(wǎng)站著色。<p>
    下面的代碼演示了如何使用 <style> 應用文本顏色部分。<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

    同樣,此示例采用樣式部分來聲明十六進制顏色,后跟“#”符號。

    代碼:

    
    
    
     Color Picker
    
    
    

    changing text color?

    hello world

    Hexa paragraph text

    輸出:

    HTML 顏色?

    3.使用 RGB 顏色

    紅、綠、藍各使用8位,其值在0到255之間變化,從而產(chǎ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.創(chuàng)建個人 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 顏色?的詳細內(nèi)容。更多信息請關注PHP中文網(wǎng)其他相關文章!

    本站聲明
    本文內(nèi)容由網(wǎng)友自發(fā)貢獻,版權歸原作者所有,本站不承擔相應法律責任。如您發(fā)現(xiàn)有涉嫌抄襲侵權的內(nèi)容,請聯(lián)系admin@php.cn

    熱AI工具

    Undress AI Tool

    Undress AI Tool

    免費脫衣服圖片

    Undresser.AI Undress

    Undresser.AI Undress

    人工智能驅動的應用程序,用于創(chuàng)建逼真的裸體照片

    AI Clothes Remover

    AI Clothes Remover

    用于從照片中去除衣服的在線人工智能工具。

    Clothoff.io

    Clothoff.io

    AI脫衣機

    Video Face Swap

    Video Face Swap

    使用我們完全免費的人工智能換臉工具輕松在任何視頻中換臉!

    熱工具

    記事本++7.3.1

    記事本++7.3.1

    好用且免費的代碼編輯器

    SublimeText3漢化版

    SublimeText3漢化版

    中文版,非常好用

    禪工作室 13.0.1

    禪工作室 13.0.1

    功能強大的PHP集成開發(fā)環(huán)境

    Dreamweaver CS6

    Dreamweaver CS6

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

    SublimeText3 Mac版

    SublimeText3 Mac版

    神級代碼編輯軟件(SublimeText3)

    構建網(wǎng)頁的HTML元素是什么? 構建網(wǎng)頁的HTML元素是什么? Jul 03, 2025 am 02:34 AM

    網(wǎng)頁結構需核心HTML元素支撐,1.頁面整體結構由、、構成,其中為根元素,存放元信息,展示內(nèi)容;2.內(nèi)容組織依賴標題(-)、段落()及區(qū)塊標簽(如、)以提升條理與SEO;3.導航通過與實現(xiàn),常用組織鏈接并輔以aria-current屬性增強可訪問性;4.表單交互涉及、、與,確保用戶輸入與提交功能完整。正確使用這些元素能提升頁面清晰度、維護性及搜索引擎優(yōu)化。

    為現(xiàn)代頁面宣布正確的HTML5 Doctype。 為現(xiàn)代頁面宣布正確的HTML5 Doctype。 Jul 03, 2025 am 02:35 AM

    Doctype是告訴瀏覽器用哪種HTML標準解析頁面的聲明,現(xiàn)代網(wǎng)頁只需在HTML文件最開頭寫。其作用是確保瀏覽器以標準模式而非怪異模式渲染頁面,且必須位于第一行,前面不能有空格或注釋;正確寫法僅有一種,不推薦使用舊版本或其他變體;其他如charset、viewport等應放在部分。

    如何使用HTML將選項分組? 如何使用HTML將選項分組? Jul 04, 2025 am 03:16 AM

    在HTML中使用標簽可以對下拉菜單中的選項進行分組。具體方法是用包裹一組元素,并通過label屬性定義組名,如:1.包含蘋果、香蕉、橙子等選項;2.包含胡蘿卜、西蘭花等選項;3.每個為一個獨立分組,組內(nèi)選項自動縮進。注意事項包括:①不支持嵌套;②可通過disabled屬性禁用整個組;③樣式受限需結合CSS或第三方庫美化;可使用Select2等插件增強功能。

    將CSS和JavaScript與HTML5結構有效整合。 將CSS和JavaScript與HTML5結構有效整合。 Jul 12, 2025 am 03:01 AM

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

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

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

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

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

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

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

    如何使用HTML iframe標簽從另一個站點嵌入內(nèi)容? 如何使用HTML iframe標簽從另一個站點嵌入內(nèi)容? Jul 04, 2025 am 03:17 AM

    使用標簽可以將其他網(wǎng)站內(nèi)容嵌入到自己的網(wǎng)頁中,基本語法為:,可添加width、height和style="border:none;"等屬性控制外觀;為了實現(xiàn)響應式布局,可通過百分比設置尺寸或使用容器結合padding和絕對定位保持寬高比,同時注意跨域限制、加載性能、SEO影響及安全策略等注意事項;常見用途包括嵌入地圖、第三方表單、社交媒體內(nèi)容及內(nèi)部系統(tǒng)集成。

    See all articles
    <samp id="m00us"></samp>
  • <blockquote id="m00us"><tfoot id="m00us"></tfoot></blockquote>