HTML | Bgcolor Attribute - GeeksforGeeks
Có thể bạn quan tâm
- Courses
- DSA to Development
- Machine Learning & Data Science
- Generative AI & ChatGPT
- Become AWS Certified
- DSA Courses
- Data Structure & Algorithm(C++/JAVA)
- Data Structure & Algorithm(Python)
- Data Structure & Algorithm(JavaScript)
- Programming Languages
- CPP
- Java
- Python
- JavaScript
- C
- All Courses
- Tutorials
- Python Tutorial
- Taking Input in Python
- Python Operators
- Python Data Types
- Python Loops and Control Flow
- Python Conditional Statements
- Python Loops
- Python Functions
- Python OOPS Concept
- Python Data Structures
- Python Exception Handling
- Python File Handling
- Python Exercises
- Java
- Learn Java Programming Language
- Java Collections
- Java 8 Tutorial
- Java Programs
- Java Interview Questions
- Java Interview Questions
- Core Java Interview Questions-Freshers
- Java Multithreading Interview Questions
- OOPs Interview Questions and Answers
- Java Exercises
- Java Quiz
- Java Quiz
- Core Java MCQ
- Java Projects
- Advance Java
- Spring Tutorial
- Spring Boot Tutorial
- Spring Boot Interview Questions
- Spring MVC Tutorial
- Spring MVC Interview Questions
- Hibernate Tutorial
- Hibernate Interview Questions
- Programming Languages
- JavaScript
- C++
- R Tutorial
- SQL
- PHP
- C#
- C
- Scala
- Perl
- Go Language
- Kotlin
- System Design
- System Design Tutorial
- Software Design Patterns
- System Design Roadmap
- Top 10 System Design Interview Questions and Answers
- Interview Corner
- Company Preparation
- Top Topics
- Practice Company Questions
- Interview Experiences
- Experienced Interviews
- Internship Interviews
- Competitive Programming
- Multiple Choice Quizzes
- Aptitude for Placements
- Computer Science Subjects
- Operating System
- DBMS
- Computer Networks
- Engineering Mathematics
- Computer Organization and Architecture
- Theory of Computation
- Compiler Design
- Digital Logic
- Software Engineering
- DevOps
- GIT
- AWS
- Docker
- Kubernetes
- Microsoft Azure Tutorial
- Google Cloud Platform
- Linux
- Linux Tutorial
- Linux Commands A-Z
- Linux Commands Cheatsheet
- File Permission Commands
- Linux System Administration
- Linux File System
- Linux Shell Scripting
- Linux Networking
- Linux Interview Questions
- Software Testing
- Software Testing Tutorial
- Software Engineering Tutorial
- Testing Interview Questions
- Jira
- Databases
- DBMS Tutorial
- SQL Tutorial
- PostgreSQL Tutorial
- MongoDB Tutorial
- SQL Interview Questions
- MySQL Interview Questions
- PL/SQL Interview Questions
- Android
- Android Tutorial
- Android Studio Tutorial
- Kotlin For Android
- Android Projects
- Android Interview Questions
- 6 Weeks of Android App Development
- Excel
- MS Excel Tutorial
- Introduction to MS Excel
- Data Analysis in Excel
- Basic Excel Formulas & Functions
- Data Analysis in Advanced Excel
- Workbooks
- Statistical Functions
- Data Visualization in Excel
- Pivot Tables in Excel
- Excel Spreadsheets in Python
- Basic Excel Shortcuts
- Mathematics
- Number System
- Algebra
- Linear Algebra
- Trigonometry
- Set Theory
- Statistics
- Probability
- Geometry
- Mensuration
- Logarithms
- Calculus
- Python Tutorial
- DSA
- Data Structures
- Arrays
- Matrix
- Strings
- Linked List
- Stack
- Queue
- Tree
- Heap
- Hashing
- Graph
- Set Data Structure
- Map Data Structure
- Advanced Data Structure
- Data Structures Tutorial
- Algorithms
- Analysis of Algorithms
- Design and Analysis of Algorithms
- Asymptotic Analysis
- Asymptotic Notations
- Worst, Average and Best Cases
- Searching Algorithms
- Linear Search
- Binary Search
- Searching Algorithms Tutorial
- Sorting Algorithms
- Selection Sort
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Counting Sort
- Radix Sort
- Bucket Sort
- Sorting Algorithms Tutorial
- Greedy Algorithms
- Dynamic Programming
- Graph Algorithms
- Pattern Searching
- Recursion
- Backtracking
- Divide and Conquer
- Mathematical Algorithms
- Geometric Algorithms
- Bitwise Algorithms
- Randomized Algorithms
- Branch and Bound
- Algorithms Tutorial
- Analysis of Algorithms
- DSA Tutorial
- Practice
- All DSA Problems
- Problem of the Day
- Company Wise Coding Practice
- Amazon
- Microsoft
- Flipkart
- Explore All
- GfG SDE Sheet
- Practice Problems Difficulty Wise
- School
- Basic
- Easy
- Medium
- Hard
- Language Wise Coding Practice
- CPP
- Java
- Python
- Curated DSA Lists
- Beginner's DSA Sheet
- Top 50 Array Problems
- Top 50 String Problems
- Top 50 DP Problems
- Top 50 Graph Problems
- Top 50 Tree Problems
- Competitive Programming
- Company Wise SDE Sheets
- Facebook SDE Sheet
- Amazon SDE Sheet
- Apple SDE Sheet
- Netflix SDE Sheet
- Google SDE Sheet
- DSA Cheat Sheets
- SDE Sheet
- DSA Sheet for Beginners
- FAANG Coding Sheet
- Product-Based Coding Sheet
- Company-Wise Preparation Sheet
- Top Interview Questions
- Puzzles
- All Puzzles
- Top 100 Puzzles Asked In Interviews
- Top 20 Puzzles Commonly Asked During SDE Interviews
- Data Structures
- Data Science
- Python Tutorial
- R Tutorial
- Machine Learning
- Data Science using Python
- Data Science using R
- Data Science Packages
- Pandas Tutorial
- NumPy Tutorial
- Data Visualization
- Python Data Visualization Tutorial
- Data Visualization with R
- Data Analysis
- Data Analysis with Python
- Data Analysis with R
- Deep Learning
- NLP Tutorial
- Web Tech
- HTML Tutorial
- CSS Tutorial
- JavaScript Tutorial
- PHP Tutorial
- ReactJS Tutorial
- NodeJS Tutorial
- Bootstrap Tutorial
- Typescript
- Web Development Using Python
- Django
- Django Tutorial
- Django Projects
- Django Interview Questions
- Flask
- Flask Tutorial
- Flask Projects
- Flask Interview Questions
- Postman
- Github
- Django
- Cheat Sheets
- HTML Cheat Sheet
- CSS Cheat Sheet
- JavaScript Cheat Sheet
- React Cheat Sheet
- Angular Cheat Sheet
- jQuery Cheat Sheet
- Bootstrap Cheat Sheet
- Learn Complete Web Development
- HTML Tutorial
- HTML Exercises
- HTML Tags
- HTML Attributes
- Global Attributes
- Event Attributes
- HTML Interview Questions
- HTML DOM
- DOM Audio/Video
- HTML 5
- HTML Examples
- Color Picker
- A to Z Guide
- HTML Formatter
HTML bgcolor attribute is used to set the background color of an HTML element. Bgcolor is one of those attributes that has become deprecated with the implementation of Cascading Style Sheets (see CSS Backgrounds). It accepts color names, hexadecimal color codes, or RGB values to customize the background appearance of the specified element. In modern web development, styling, including background color is typically handled using CSS properties rather than HTML attributes.
Note: The bgcolor attribute is not supported in HTML5.
Syntax
<"tag" bgcolor="color_name | hex_value | rgb_value">Attribute Values
Attribute Values | Description |
---|---|
color_name | It sets the background color by using the color name. For example “red”. |
hex_number | It sets the background color by using the color hex code. For example “#0000ff”. |
rgb_number | It sets the background color by using the RGB code. For example: “RGB(0, 153, 0)”. |
Supported tags
Tag | Description |
---|---|
<body> | Contains content visible to users. |
<marquee> | Scrolls text or images within a container. |
<table> | Organizes data into rows and columns. |
<tbody> | Encloses main content rows within a table. |
<td> | Represents data cells within a table row. |
<tfoot> | Defines a footer section within a table. |
<th> | Indicates header cells within a table row. |
<thead> | Contains header rows within a table. |
<tr> | Represents a table row, containing data or headers. |
<col> | Defines properties for one or more table columns. |
<colgroup> | Groups one or more columns in a table for styling. |
Example 1: In this example, the table’s background color is set to green using the bgcolor attribute.
html <!DOCTYPE html> <html> <head> <title> HTML table bgcolor Attribute </title> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML table bgcolor Attribute</h2> <table border="1" bgcolor="green"> <caption> Author Details </caption> <tr> <th>NAME</th> <th>AGE</th> <th>BRANCH</th> </tr> <tr> <td>BITTU</td> <td>22</td> <td>CSE</td> </tr> <tr> <td>RAM</td> <td>21</td> <td>ECE</td> </tr> </table> </body> </html>Output:
Example 2: In this example, the bgcolor attribute within the <body> tag is used to set the background color of the entire page to orange.
html <!DOCTYPE html> <html> <head> <title> HTML body Bgcolor Attribute </title> </head> <!-- body tag starts here --> <body text="green" bgcolor="orange"> <center> <h1>GeeksforGeeks</h1> <h2> HTML body bgcolor Attribute </h2> <p> It is a Computer Science portal For Geeks </p> </center> </body> <!-- body tag ends here --> </html>Output:
Supported Browsers:
- Google Chrome
- Edge
- Firefox
- Opera
- Safari
HTML bgcolor Attribute FAQs
Can I use named colors with the bgcolor attribute?
Yes, the bgcolor attribute accepts named colors (e.g., bgcolor=”red”), hexadecimal values (e.g., bgcolor=”#FF0000″), or RGB values (e.g., bgcolor=”rgb(255,0,0)”).
Why is the bgcolor attribute deprecated?
The bgcolor attribute is deprecated because inline styles like this reduce the separation of content and design, which makes maintaining the code more difficult. CSS provides a more flexible and powerful way to handle styling.
What are the alternatives to using the bgcolor attribute?
The recommended alternative is to use CSS for styling. For example, use style=”background-color: #FF0000;” or add a CSS rule in a stylesheet.
Does the bgcolor attribute work on all HTML elements?
The bgcolor attribute was traditionally used on <body>, <table>, <tr>, and <td> elements, but it is not applicable to all HTML elements.
Can I use gradient colors with the bgcolor attribute?
Comment More info Next Article HTML border attributeNo, the bgcolor attribute does not support gradient colors. To use gradients, you must use CSS, like background: linear-gradient(to right, #ff0000, #00ff00);.
V
Vijay Sirra Follow ImproveSimilar Reads
- HTML accept Attribute HTML accept Attribute specifies the type of file that the server accepts. This attribute can be used with <input> element only. This attribute is not used for validation tools because file uploads should be validated on the Server. Syntax: <input accept = "file_extension"> Note: This att 3 min read
- HTML accept-charset Attribute The accept-charset attribute is used to define the character encoding and is used for form submission. The default value of the accept-charset attribute is "UNKNOWN" string which indicates the encoding equals to the encoding of the document containing the <form> element. Syntax: <form accep 2 min read
- HTML accesskey Attribute The accesskey attribute in HTML is the keyboard shortcut to activate/focus specific elements. The access key attribute is browser-dependent. It may vary from browser to browser. Supported Tags: It supports all HTML elements. Syntax<element accessKey = "single_character">Shortcut to use accessk 3 min read
- HTML action Attribute The HTML action Attribute is used to specify where the form data is to be sent to the server after the submission of the form. When a user submits a form, the browser sends the data to the specified URL, allowing server-side scripts to handle the information and generate a response. Note: It can be 2 min read
- HTML align Attribute HTML align Attribute in HTML is used to specify the alignment of the text content of The Element. This attribute is used in all elements. The Align attribute can also be set using the CSS property "text-align: " or in <img> "vertical-align: ". For horizontal alignment, use align with values li 2 min read
- HTML alt attribute The alt attribute in HTML provides alternative text for images, aiding accessibility and providing context for screen readers. Syntax: <img src=" " alt=" " >Supported tags: Name Description area <area>'s alt provides alternative text for image map areas. image <img> alt offers alte 3 min read
- HTML async Attribute The HTML async attribute is a boolean attribute. When present, it specifies that the script will be executed asynchronously when it is available. This attribute only works for external scripts (and is used only when the src attribute is present ). Note: There are so many ways in which external scrip 2 min read
- HTML autocomplete Attribute The HTML autocomplete Attribute is used to specify whether the input field autocompleted would be on or off. When the autocomplete attribute is set to on the browser will automatically complete the values based on what the user entered before. It works with input fields such as text, search, URL, em 3 min read
- HTML autoplay Attribute The HTML autoplay Attribute, a boolean attribute, enables audio or video elements to start playing automatically when the page loads, providing seamless playback without interruption. Syntax: <element autoplay> Supported ElementsIt can be used with <audio> and <video> elements. El 2 min read
- HTML autofocus Attribute The HTML autofocus attribute is a powerful tool that enhances user experience by automatically setting the focus to a specific element when a webpage loads. This attribute is boolean, meaning it can either be present or absent. Syntax: <elementName autofocus>Supported Tags ElementPurposeButton 2 min read
- HTML bgcolor Attribute HTML bgcolor attribute is used to set the background color of an HTML element. Bgcolor is one of those attributes that has become deprecated with the implementation of Cascading Style Sheets (see CSS Backgrounds). It accepts color names, hexadecimal color codes, or RGB values to customize the backgr 3 min read
- HTML border attribute The HTML border attribute is used to set the visible border width to most HTML elements within the body. Note: The HTML border attribute is not supported in HTML5. Syntax: <tag border="value">Supported tags: TableImageObjectExample 1: In this example, we will see code for the table border at 2 min read
- HTML charset Attribute The charset attribute in HTML is used to define the character encoding. The charset attribute is used with the <meta> and <script> elements.Charset attribute in <meta> Tag: The charset attribute is present in the meta element. It specifies the character encoding for the HTML docume 2 min read
- HTML checked Attribute The checked attribute in HTML is used to indicate whether an element should be checked when the page loads up. It is a Boolean attribute. Note: It can be used with <input> element only where the type is either "checkbox" or "radio". This attribute has been DEPRECATED and is no longer recomme 2 min read
- HTML cite attribute The HTML cite attribute is used to specify the URL of the document that explains the quotes, message, or text that describes why the text was inserted.This attribute can be used with the following elements: HTML | <blockquote> cite AttributeHTML | <del> cite AttributeHTML | <ins> c 2 min read
- HTML Class Attribute The HTML class attribute is used to assign one or more CSS classes to an HTML element. By using classes, you can group elements together and apply consistent styles across them, streamlining both design and functionality. HTML class attribute Supported Tags: It supports all HTML elements. Syntax< 3 min read
- HTML cols Attribute The cols attribute in HTML is used to tell the browser how many average-width characters should fit on a single line i.e. the number of columns to display. Note: This attribute is only applicable on <textarea> and <frameset>. Syntax: <textarea cols = "value">Text content...</tex 2 min read
- HTML colspan Attribute The colspan attribute in HTML specifies the number of columns a cell should span. It allows the single table cell to span the width of more than one cell or column. It provides the same functionality as "merge cell" in a spreadsheet program like Excel. Note: colspan="0" tells the browser to span the 3 min read
- HTML content Attribute The HTML content Attribute is given the values related to the http-equiv or name attribute. The content attribute can associated with the <meta> element. Note: This attribute is depreciated from HTML 5. Supported Tags: <meta>Syntax: <meta content="text">Attribute Values: It contain 2 min read
- HTML contenteditable Attribute The HTML contenteditable attribute determines if element content is editable. It defaults to inheriting from the parent element. As a global attribute, it allows versatile content manipulation within the webpage directly. Syntax<element contenteditable = "true|false">Supported Tags It supports 2 min read
- HTML controls Attribute The HTML controls Attribute is used to specify that the audio and video controls must be displayed. It is a Boolean attribute and is also new in HTML5. We can use this attribute in two tags <audio> and <video> The controls attribute includes the following properties on <audio> tag: 3 min read
- HTML coords Attribute The HTML coords Attribute is used to specify the coordinate of an area in an image-map. It is used with shape attribute to specify the size, shape, and placement of an area. (0, 0) is the coordinate of the top-left corner.Syntax: <element coords="value">Supported Tags: <area> Attribute V 3 min read
- HTML data Attribute The HTML data Attribute is used to specify the URL of the Embedded file of the Object. It can be used with the <object> element. Syntax: <object data="URL">Attribute Values: It contains a single value URL which is used to specify the source of the object. The possible values of URL are: 2 min read
- HTML data Attribute The HTML data Attribute is used to specify the URL of the Embedded file of the Object. It can be used with the <object> element. Syntax: <object data="URL">Attribute Values: It contains a single value URL which is used to specify the source of the object. The possible values of URL are: 2 min read
- HTML datetime Attribute The HTML datetime attribute specifies the date and time associated with the content, facilitating machine-readable information. It's commonly used with elements like <time> to provide structured time-related data. Syntax<element datetime="YYYY-MM-DDThh:mm:ssTZD"> Attribute ValuesThis att 3 min read
- HTML default Attribute The HTML default Attribute is a Boolean attribute. This attribute is used to specify that the track will be enabled if the user's preferences do not indicate that another track would be more appropriate. Note: With a default attribute, there must not be more than one track element per media element. 2 min read
- HTML defer Attribute The defer attribute can be added to <script> elements that point to an external JavaScript file. It ensures that the script is executed only after the HTML document has been completely loaded and parsed, but before the DOMContentLoaded event is fired. It ensures that scripts do not block HTML 4 min read
- HTML dir Attribute The HTML dir attribute specifies the text directionality, allowing content to be displayed from left-to-right (ltr), right-to-left (rtl), or determined automatically (`auto`) by the browser based on content. Supported Tags: It supports all HTML elements. Syntax<element dir = "ltr | rtl | auto" 2 min read
- HTML dirname Attribute The HTML dirname AttributeAfter submitting the form, the HTML dirname Attribute is used to enable the text direction of the input and the Textarea Field. The value of the dirname attribute must be the input field's name and textarea, followed by “.dir”. it can be used with both the <input> and 2 min read
- HTML disabled Attribute The disabled attribute in HTML indicates whether the element is disabled or not. If this attribute is set, the element is disabled. The disabled attribute is usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused. It is a boolean att 5 min read
- HTML download Attribute The HTML download Attribute is used to download the element when the user clicks on the hyperlink. It is used only when the href attribute is set. The downloaded file name will be the value of the attribute. The value of the attribute will be the name of the downloaded file. If the value is removed 2 min read
- HTML draggable Attribute The HTML draggable attribute allows elements to be dragged and dropped within or between web pages. When set to "true", elements become draggable, facilitating interactive user experiences such as drag-and-drop functionality in web applications. Supported TagsIt supports all HTML elements. Syntax 2 min read
- HTML dropzone Attribute The dropzone attribute in HTML is used to specify whether the dragged data is copied, moved, or linked when it is dropped on any element. This attribute is new in HTML5. Syntax: <element dropzone = "move | link | copy">Attribute Value: move: This attribute is used to drag the data and drop it 2 min read
- HTML enctype Attribute HTML enctype Attribute specifies that data will be present in the form and should be encoded when submitting to the server. This type of attribute can be used only if method = "POST". Syntax <form enctype = "value">Attribute ValuesThis attribute contains three values which are listed below: At 2 min read
- HTML for Attribute The for attribute in HTML is used with <label> and <output> elements to associate them with a specific form control (e.g., <input>, <textarea>), by matching the for attribute's value to the id of the target element. Supported Tags : <label> <output>Syntax: <l 3 min read
- HTML form Attribute HTML form attributes define the behavior and properties of a form element. They include attributes like action for specifying where form data is sent, a method for the HTTP method used, and autocomplete for browser input suggestions, among others. List of HTML form Attribute:AttributeDescriptionActi 3 min read
- HTML formaction Attribute The HTML formaction Attribute determines the submission destination of form data, overriding the form's default action. It's exclusively applied to input/buttons with type="submit". Syntax< element formaction="URL">Supported Tags<button><input type="image"> or <input type = "sub 2 min read
- HTML headers attribute The HTML headers attribute is used in table cells (td and th elements) to associate data cells with header cells, aiding accessibility by providing context for screen readers and other assistive technologies. Supported Tagstd headersth headersSyntax<td header="header_value"></td><th h 2 min read
- HTML height Attribute The HTML height attribute is used to specify the height of the Element. It can be used on the following elements: Name Description <canvas> The <canvas> element is used for drawing graphics dynamically. <embed> <embed> element embeds external content like multimedia within HT 2 min read
- HTML hidden Attribute The HTML hidden Attribute, a boolean attribute, hides elements from display in browsers. It's useful for elements not yet relevant or hidden until certain conditions are met via JavaScript. Syntax<element hidden>Note: This attribute is new in HTML 5. Supported TagsThis is a Global attribute an 2 min read
- HTML high Attribute The HTML high Attribute is used to specify the range where the value of the gauge is considered to be of high value. The value of the high attribute would be less than the max attribute but more than the min and low attribute values. It can be used with the <meter> Element. Applicable: <met 2 min read
- HTML href Attribute HTML href Attribute: It is used to specify the URL of the document. It contains the full address of the page that the user requests. It is used to link or connect one document to another document. Supported tags:HTML <a> href AttributeHTML <base> href AttributeHTML <area> href Attr 3 min read
- HTML hreflang Attribute HTML hreflang Attribute is used to specify the language for a linked document. It is used only when the href attribute is set. Syntax: <element hreflang="language_code"> Attribute Value: The hreflang attribute contains a single value language_code which is the two-letter language code and used 2 min read
- HTML | http-equiv Attribute The HTML http-equiv Attribute is used to provide header information or value of the content Attribute. It can be used to simulate an HTTP Header response. Uses: It can be used in meta Element. Syntax: <meta http-equiv="content-type | default-style | refresh"> Example: C/C++ Code <!DOCTYPE h 1 min read
- HTML Id Attribute HTML id attribute provides a unique identifier for an element within a document. It allows targeted selection and manipulation of the element through CSS and JavaScript, facilitating specific styling and functionality. In CSS, the id attribute is used using the # symbol followed by id. quotes are no 5 min read
- HTML ismap Attribute The HTML ismap attribute is a boolean attribute. When exists, it specifies that the image is a component element of a server-side image-map (an image-map is a picture with clickable areas). When clicking on a server-side image-map, the press coordinates square measure sent to the server as a URL que 2 min read
- HTML kind Attribute The HTML kind Attribute is used to specify the kind of the track. This attribute is only used in <Track> element. Syntax: <track src="subtitles_en.vtt" kind="subtitles" srclang="en">Applicable: <track>Example: [GFGTABS] html <!DOCTYPE html> <html> <head> <style 2 min read
- HTML label Attribute The HTML label Attribute is used to specify the title of the Text Track. The title of the Text Track is used by the browser when listing available text tracks. It is used in <track> element. Syntax: <track label="English"> HTML label Attribute Supported Tags: <track><option> 2 min read
- HTML lang Attribute This attribute is used to specify the language of the element content. Some examples of languages are en for English, es for Spanish, etc. Syntax: <element lang = "language_code">Attribute Value: This attribute contains a single value language_code which is used to specify the language of the 2 min read
- HTML list Attribute The HTML list attribute associates an input field with a datalist element, providing a predefined list of options for user selection. Usage: This attribute is used by the <input> element. Syntax: <input list="name">Where name is a string that will work as id and will be used to link the 3 min read
- HTML loop Attribute The HTML loop Attribute is used to restart the audio and video again and again after finishing it. It contains the Boolean value. Syntax: <element loop>Applicable <audio><video><marquee><bgsound>Example 1: Below Example illustrates the use of loop attribute in < 2 min read
- HTML | low Attribute The HTML | low attribute is used to specify the range where the value of gauge is considered to be low. The value of the low attribute must be greater than the “min”, less than the “max” and “high” attribute. Usage: This attribute is only used with the <meter> tag. Syntax: <meter low="numbe 1 min read
- HTML max attribute In HTML max attribute it specifies the maximum value of an element. when the max attribute is used by the progress element, it specifies how much work the task requires in the total task. Syntax<element max="value" >Supported Tags:The max attribute is used on the following elements: Name Desc 2 min read
- HTML maxlength Attribute It specifies the maximum number of characters that have been allowed in the Element. It can be used on the following Elements: <input><textarea>Attribute Values: It contains a single value number that allows the maximum number of characters in the <input> element. Its default valu 2 min read
- HTML media attribute The HTML media attribute is employed to specify the media or device the coupled document is optimized for. This attribute specifies that the target URL is designed for special devices like iPhones, speech, or print media. syntax<element media="value">Supported TagsElementDescription<a>R 3 min read
- HTML method Attribute The HTML method Attribute is used to specify the HTTP method used to send data while submitting the form. There are two kinds of HTTP Methods, which are GET and POST. The method attribute can be used with the <form> element. Attribute Values: GET: It is the default value. In the GET method, af 2 min read
- HTML min Attribute HTML min attribute specifies the minimum value for an input element. It is commonly used with input types like number, date, and time to define the minimum acceptable value. The value of the min attribute must be less than the value of the max attribute. It has a default value which is 0. Table of C 4 min read
- HTML multiple Attribute HTML multiple attribute is used to add several settings to a single element, enhancing its functionality. For example, a link can have both href and target attribute, determining where it leads and how it opens. Using multiple attributes allows you to customize your HTML elements to better suit your 3 min read
- HTML muted Attribute The HTML muted Attribute is used to specify the audio output of the video is muted, it is a Boolean attribute. Applicable: <video muted Attribute>Syntax <video muted>Example: In this example, we demonstrate the muted attribute in a <video> element, which mutes the audio. It include 2 min read
- HTML name Attribute The HTML name attribute labels elements, notably form inputs, identifying them for data submission. It's crucial for form processing and is often used in JavaScript DOM manipulation. Unique within a form. Note: This attribute has been DEPRECATED and is no longer recommended. Supported tags: ElementD 3 min read
- HTML novalidate Attribute The HTML novalidate Attribute is used to specify that the form-data should not be validated when submitting the form. It is a Boolean attribute. It can be used with the <form> element. Applicable: <form>Syntax: <form novalidate>Example: This Example illustrates the use of novalidat 2 min read
- HTML onblur Attribute This attribute fires at that moment when the element loses focus. This attribute is mostly used in the Form validation code. This attribute is the opposite of onfocus attribute.Supported Tags: It supports all HTML elements except these elements which are given below : <base> <bdo> <br 2 min read
- HTML oncopy Attribute The oncopy Attribute attribute fires when the user copies the content present in an element. The oncopy attribute is used with <img>, <input>, <p> etc elements. It basically triggers on user-initiated copy operations and customizes behavior when content is copied. Syntax<element 3 min read
- HTML oncut Attribute This attribute fires when the user cut or deletes the content that has been present in the element. It is a Boolean-type attribute. This attribute is supported by all HTML elements but it is possible for that element which has a ContentEditable attribute set to "true". Note:There are 3 ways to cut t 3 min read
- HTML onkeypress Attribute This attribute fires when a user presses a key on the Keyboard. This event attribute can not be used for all keys (e.g. ALT, CTRL, SHIFT, ESC) in all browsers.Supported Tags: All HTML elements, EXCEPT: <base><bdo><br><head><html><iframe><meta><param> 2 min read
- HTML onmousedown Attribute This onmousedown attribute will fire when a mouse button is pressed down on the element and the order of events occur related to the onmousedown event(for the left/mouse button) onmousedownonmouseuponclickSupported Tags: It supports all HTML elements. Syntax: <element onmousedown="script">Attr 2 min read
- HTML onscroll Attribute The onscroll attribute works when an element scrollbar is being scrolled. To create a scrollbar in an element, use the CSS overflow property. It is triggered when the content within an HTML element is scrolled and used to implement dynamic behaviors based on the scroll position and employed for crea 4 min read
- HTML Optimum Attribute The HTML optimum attribute specifies the optimal numeric value for <meter elements. It's an optional attribute used to indicate the ideal or preferred value within a range, providing context for measurement. Syntax: <meter optimum = "value"></meter>Attribute Values: It contains the fl 3 min read
- HTML pattern Attribute The HTML pattern attribute is used with <input> elements to specify a regular expression that the input's value must match for the form to be submitted. It enforces specific formatting rules, like requiring a certain number of characters or specific character types. Syntax: <input pattern = 2 min read
- HTML placeholder Attribute HTML placeholder attribute specifies a short hint that describes the expected value of an input field/text area. The short hint is displayed in the field before the user enters a value. Syntax: <element placeholder="">HTML placeholder Attribute ExamplesExample 1: HTML <input> placeholder 3 min read
- HTML readonly Attribute The HTML readonly attribute, when applied to input fields or text areas, prevents users from editing the content, allowing it only for viewing purposes. Syntax<input readonly>Supported Tags This attribute is used with two elements which are listed below: ElementDescription<input>Used wit 2 min read
- HTML required Attribute It is a Boolean attribute that is used to specify that the input element must be filled out before submitting the Form. Elements: These attributes can be associated with three elements which are listed below: <input><select><textarea>Syntax: <input required>Example-1: In th 3 min read
- HTML reversed Attribute It is a Boolean Attribute and is used to order the list in Descending Order(9, 8, 7, 6 .....) instead of ascending order(1, 2, 3 ....). Syntax: <ol reversed> <li> Content... </li> <li> Content... </li> ... <li> Content... </li></ol>Applicable: <ol 1 min read
- HTML rows Attribute The rows attribute in HTML is used to specify the number of visible text lines for the control i.e the number of rows to display.Note: This attribute is only applicable on <textarea>. Syntax: <textarea rows = "value">Text content...</textarea>Attribute Values: Its default value is 2 min read
- HTML rowspan Attribute The rowspan attribute in HTML specifies the number of rows a cell should span. That is if a row spans two rows, it means it will take up the space of two rows in that table. It allows the single table cell to span the height of more than one cell or row. It provides the same functionality as "merge 3 min read
- HTML selected Attribute The selected attribute in HTML is used to specify which option should be by default selected when the page loads. This is a boolean attribute. The option that has the selected attribute will be displayed by default. Syntax: <option selected>value</option>Note: This attribute can be used 2 min read
- HTML size Attribute The size attribute in HTML is used to specify the initial width for the input field and the number of visible rows for the select element.The size attribute can be used with the following elements: <input><hr><select><font> Attribute Values: It contains a numeric value that 3 min read
- HTML srclang Attribute The srclang attribute is used to specify the language of the track text. The srclang attribute can be applied on the <track> element:Note: srclang attribute is required with kind = “subtitles”. Syntax <track src="subtitles_en.vtt" kind="subtitles" srclang="en">Example: Below is an exampl 2 min read
- HTML start Attribute The start attribute in HTML is used to specify the start value for numbering the individual list item. It is used with an ordered list.Supported Tag: <ol>Syntax: <ol start = "value"> list items...</ol>Attribute Values: It contain a numeric value that defines the start value of the 2 min read
- HTML step Attribute The step attribute in HTML is used to set the discrete step size of the <input> element. The default stepping value for number inputs is 1.Usage: It works with the following input types: number, range, date, datetime-local, month, time and week.Syntax: <input step = "value">Attribute Val 2 min read
- HTML style attribute In this article, we will see the HTML style attribute, along with understanding its implementation through examples. Styles in HTML are rules that describe how a document will be presented in a browser. Style information can be either attached as a separate document or embedded in the HTML document. 3 min read
- HTML tabindex Attribute This attribute is used to specify the tab order of an element. It is used when the tab button is used for navigating. Supported Tag: It supports all HTML elements. Syntax: <element tabindex = "number">Attribute Value: This attribute contains single value number which is used to specify the tab 2 min read
- HTML target Attribute The HTML target Attribute is used to specify where to open the linked document. It can be used on various elements such as: HTML | <a> target AttributeHTML | <area> target AttributeHTML | <base> target AttributeHTML | <form> target AttributeSyntax: <element target="_blank| 2 min read
- HTML title Attribute The title attribute is used to specify extra information about the element. When the mouse moves over the element then it shows the information. Supported Tags: It supports all HTML elements. Syntax: <element title = "text">Attribute Value: This attribute contains single value text which is us 2 min read
- HTML5 translate Attribute The translate attribute in HTML is used to specify whether the content of an element is translated or not. This attribute is new in HTML5. Supported Tags: It supports all HTML elements. Syntax: <element translate = "yes|no">Attribute Values: The translate attribute contains two values which ar 2 min read
- HTML | value Attribute The value attribute in HTML is used to specify the value of the element with which it is used. It has different meaning for different HTML elements. Usage: It can be used with the following elements: <input>, <button>, <meter>, <li>, <option>, <progress>, and < 3 min read
- HTML | wrap Attribute The wrap attribute is used to specify that in which manner the text is to be wrapped in a text area when a form is submitted. The wrap attribute can be applied on the <textarea> element: Supported Tags: <Textarea> Attribute Values: soft: This is a default value. It specifies that the Tex 1 min read
- HTML
- Web Technologies
- HTML-Attributes
What kind of Experience do you want to share?
Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam ExperiencesTừ khóa » Html Color Tag Background
-
How To Add & Change Background Color In HTML - HubSpot Blog
-
HTML Colors - W3Schools
-
HTML Styles - W3Schools
-
How To Set Background Color In HTML? - Tutorialspoint
-
Change HTML Background Color Or Font Color - BitDegree
-
HTML Background Color - HTML Color Codes
-
HTML Background-color - Javatpoint
-
How To Change Background Color In HTML? - Top 5 Methods That ...
-
HTML Color Codes And Names - Computer Hope
-
Background-color - CSS: Cascading Style Sheets - MDN Web Docs
-
HTML Background Color - Set And Change - STechies
-
How To Set Background Color With HTML And CSS - W3docs
-
#FFFFFF (White) HTML Color Code - Computer Hope