Unable To Create Text Color Within Tag In Html And CSS
Trang chủ » Html Th Colors
» Unable To Create Text Color Within
Tag In Html And CSS
Có thể bạn quan tâm
Just browsing Stack Overflow? Help us improve your experience. Sign up for research -
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams Get early access and see previews of new features.
Learn more about Labs Unable to create text color within <th> tag in html and CSS Ask Question Asked 3 years, 8 months ago Modified 3 years, 8 months ago Viewed 1k times 0 I am trying to color Name and Salary in white within <th> tag. Also need background color for <th> is green. I have done background color in green but unbale to color my text in white. My code is given below:
<table style="width:90%"; border= 1px solid black;> <tr> <th style="background-color:#0C7D18"; colspan="2">Name</th> <th style="background-color:#0C7D18";>Salary</th> </tr> </table>
Unable to create text color for Name and Salary in white within <th> tag.
- html
- css
Share Improve this question Follow edited Mar 19, 2021 at 9:32 Ali Esmailpor 1,20133 gold badges1212 silver badges2323 bronze badges asked Mar 15, 2021 at 19:01 Shaon PaulShaon Paul 15311 gold badge44 silver badges1616 bronze badges 4 - 5 You should use "color" to change color of your text – Evren Commented Mar 15, 2021 at 19:03
- <table style="width:90%"; border= 1px solid black;> <tr> <th style="background-color:#0C7D18;color:#FFF;" colspan="2">Name</th> <th style="background-color:#0C7D18;color:#FFF">Salary</th> </tr> – KodeFor.Me Commented Mar 15, 2021 at 19:06
- Its works perfect. Great Thanks – Shaon Paul Commented Mar 15, 2021 at 19:07
- 1 Does this answer your question? Change color of text using css – Heretic Monkey Commented Mar 15, 2021 at 19:11
Add a comment | 2 Answers 2
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1 You have more problems than just the header color and background. Your table element syntax is wrong.
- Remove the quote after 90%
- Replace the = after border with a colon :
- Put quote after the end of your style black;">
- Add white to your headers color:#FFFFFF;
I revised the markup to include the thead and tbody and added some rows to allow a clear visual of the results.
I also put a second example in using CSS which for many circumstances is a better way to style things than in-line. For example if you have 10 header you would only need one place to change it not 10, and makes the markup a bit cleaner.
<table style="width:90%; border:1px solid black;"> <thead> <tr> <th style="background-color:#0C7D18; color:#FFFFFF" colspan="2">Name</th> <th style="background-color:#0C7D18; color:#FFFFFF">Salary</th> </tr> </thead> <tbody> <tr> <td>one</td> <td>two</td> <td>three</td> <td>up the</td> <td>hill</td> </tr> </tbody> </table>
.my-table { width: 90%; border: 1px solid black; } .my-header { background-color: #0C7D18; color: #FFFFFF; } <table class="my-table"> <thead> <tr> <th class="my-header" colspan="2">Name</th> <th class="my-header">Salary</th> </tr> </thead> <tbody> <tr> <td>one</td> <td>two</td> <td>three</td> <td>up the</td> <td>hill</td> </tr> </tbody> </table>
Share Improve this answer Follow answered Mar 18, 2021 at 12:18 Mark SchultheissMark Schultheiss 34.1k1212 gold badges7272 silver badges107107 bronze badges Add a comment | 1 background-color is used to set the color of the background.
Use color to target text color;
<table style="width:90%"; border= 1px solid black;> <tr> <th style="color:white; background-color:#0C7D18"; colspan="2">Name</th> <th style="color:white; background-color:#0C7D18";>Salary</th> </tr>
Share Improve this answer Follow answered Mar 15, 2021 at 19:09 0stone00stone0 42.9k55 gold badges5050 silver badges7878 bronze badges Add a comment | Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discarded Sign up or log in
Sign up using Google Sign up using Email and Password Submit Post as a guest
Name Email Required, but never shown
Post Your Answer Discard By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged - html
- css
or ask your own question.
- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Linked
2 Change color of text using css Related
1 changing html text colors with css 0 I Have a CSS text colour problem 3 color text in html code 2 Style <th> with classes in CSS 0 text color not changing in html 0 CSS text not changing color 2 Changing text color in html doesen't work 0 Trying to get the color to show 1 Two different colors in the same text by using html and css 1 HTML giving an issue when I try to make a color changing text CSS Hot Network Questions
- Bash builtin 'command' ignoring option '-p'
- What is this Stardew Valley item?
- Do I need Letter of invitation to Iceland?
- Publishing corollaries of previously published results
- Why gap between arrow-head and smooth line
- If "de-" means "down" or "off" and "sub-" means "under", what is the latin prefix- meaning "up"?
- What powers do police have to force people onto trains?
- Spellcheck I Before E
- How can I solve my equation with the best numerical precision?
- Why don't routers answer ARP requests for IP addresses they can handle even if they aren't assigned that IP address themselves?
- Can you please advise on kerning?
- Can the US President and Vice President swap places to avoid 22nd Amendment?
- Table structure with multiple foreign keys and values
- Does "binary" affect our Being?
- Angular orientation of exact solution of the Hydrogen Schrödinger Equation
- Groups with no proper non-trivial fully invariant subgroup
- How do different observers decide if they are looking at the same thing?
- Creating table from polygon or closed polylines in QGIS
- Path from plane
- What would T-Rex cavalry be used for?
- "Eligible" vs "Elected" in the drafting of the 22nd amendment
- Function works when evaluated in the `*scratch*` buffer, but not when evaluated in an Org Source Block. Why?
- Why is Anarchism not considered fundamentally against the "democratic order" in Germany?
- Static vs dynamic certificate pinning
more hot questions Question feed Subscribe to RSS Question feed To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-html
Từ khóa » Html Th Colors
-
HTML Th Tag - W3Schools
-
HTML | Bgcolor Attribute - GeeksforGeeks
-
HTML Table Background Color
-
Table Background Color
-
Table Colors & Background : MGA - Web Development Tutorials
-
Coloring CSS Tables - HTML
-
HTML Table Basics
-
Tables - Bootstrap
-
HTML Th Bgcolor Attribute - W3Schools
-
Applying Color To HTML Elements Using CSS - MDN Web Docs
-
CSS: Even And Odd Rules - W3C
-
How To Change The Background Color Of An HTML Table - ThoughtCo
-
CSS/Table Styles/table Background Color - TAG Index
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu
Trang chủ » Html Th Colors » Unable To Create Text Color Within
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs Unable to create text color within <th> tag in html and CSS Ask Question Asked 3 years, 8 months ago Modified 3 years, 8 months ago Viewed 1k times 0I am trying to color Name and Salary in white within <th> tag. Also need background color for <th> is green. I have done background color in green but unbale to color my text in white. My code is given below:
<table style="width:90%"; border= 1px solid black;> <tr> <th style="background-color:#0C7D18"; colspan="2">Name</th> <th style="background-color:#0C7D18";>Salary</th> </tr> </table>
Unable to create text color for Name and Salary in white within <th> tag.
- html
- css
- 5 You should use "color" to change color of your text – Evren Commented Mar 15, 2021 at 19:03
- <table style="width:90%"; border= 1px solid black;> <tr> <th style="background-color:#0C7D18;color:#FFF;" colspan="2">Name</th> <th style="background-color:#0C7D18;color:#FFF">Salary</th> </tr> – KodeFor.Me Commented Mar 15, 2021 at 19:06
- Its works perfect. Great Thanks – Shaon Paul Commented Mar 15, 2021 at 19:07
- 1 Does this answer your question? Change color of text using css – Heretic Monkey Commented Mar 15, 2021 at 19:11
2 Answers 2
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 1You have more problems than just the header color and background. Your table element syntax is wrong.
- Remove the quote after 90%
- Replace the = after border with a colon :
- Put quote after the end of your style black;">
- Add white to your headers color:#FFFFFF;
I revised the markup to include the thead and tbody and added some rows to allow a clear visual of the results.
I also put a second example in using CSS which for many circumstances is a better way to style things than in-line. For example if you have 10 header you would only need one place to change it not 10, and makes the markup a bit cleaner.
<table style="width:90%; border:1px solid black;"> <thead> <tr> <th style="background-color:#0C7D18; color:#FFFFFF" colspan="2">Name</th> <th style="background-color:#0C7D18; color:#FFFFFF">Salary</th> </tr> </thead> <tbody> <tr> <td>one</td> <td>two</td> <td>three</td> <td>up the</td> <td>hill</td> </tr> </tbody> </table>
.my-table { width: 90%; border: 1px solid black; } .my-header { background-color: #0C7D18; color: #FFFFFF; } <table class="my-table"> <thead> <tr> <th class="my-header" colspan="2">Name</th> <th class="my-header">Salary</th> </tr> </thead> <tbody> <tr> <td>one</td> <td>two</td> <td>three</td> <td>up the</td> <td>hill</td> </tr> </tbody> </table>
Share Improve this answer Follow answered Mar 18, 2021 at 12:18 Mark SchultheissMark Schultheiss 34.1k1212 gold badges7272 silver badges107107 bronze badges Add a comment | 1background-color is used to set the color of the background.
Use color to target text color;
<table style="width:90%"; border= 1px solid black;> <tr> <th style="color:white; background-color:#0C7D18"; colspan="2">Name</th> <th style="color:white; background-color:#0C7D18";>Salary</th> </tr>
Share Improve this answer Follow answered Mar 15, 2021 at 19:09 0stone00stone0 42.9k55 gold badges5050 silver badges7878 bronze badges Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged - html
- css
or ask your own question.
- The Overflow Blog
- Your docs are your infrastructure
- Featured on Meta
- More network sites to see advertising test [updated with phase 2]
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Linked
2 Change color of text using cssRelated
1 changing html text colors with css 0 I Have a CSS text colour problem 3 color text in html code 2 Style <th> with classes in CSS 0 text color not changing in html 0 CSS text not changing color 2 Changing text color in html doesen't work 0 Trying to get the color to show 1 Two different colors in the same text by using html and css 1 HTML giving an issue when I try to make a color changing text CSSHot Network Questions
- Bash builtin 'command' ignoring option '-p'
- What is this Stardew Valley item?
- Do I need Letter of invitation to Iceland?
- Publishing corollaries of previously published results
- Why gap between arrow-head and smooth line
- If "de-" means "down" or "off" and "sub-" means "under", what is the latin prefix- meaning "up"?
- What powers do police have to force people onto trains?
- Spellcheck I Before E
- How can I solve my equation with the best numerical precision?
- Why don't routers answer ARP requests for IP addresses they can handle even if they aren't assigned that IP address themselves?
- Can you please advise on kerning?
- Can the US President and Vice President swap places to avoid 22nd Amendment?
- Table structure with multiple foreign keys and values
- Does "binary" affect our Being?
- Angular orientation of exact solution of the Hydrogen Schrödinger Equation
- Groups with no proper non-trivial fully invariant subgroup
- How do different observers decide if they are looking at the same thing?
- Creating table from polygon or closed polylines in QGIS
- Path from plane
- What would T-Rex cavalry be used for?
- "Eligible" vs "Elected" in the drafting of the 22nd amendment
- Function works when evaluated in the `*scratch*` buffer, but not when evaluated in an Org Source Block. Why?
- Why is Anarchism not considered fundamentally against the "democratic order" in Germany?
- Static vs dynamic certificate pinning
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Th Colors
-
HTML Th Tag - W3Schools
-
HTML |
Bgcolor Attribute - GeeksforGeeks HTML Table Background Color
Table Background Color
Table Colors & Background : MGA - Web Development Tutorials
Coloring CSS Tables - HTML
HTML Table Basics
Tables - Bootstrap
HTML Th Bgcolor Attribute - W3Schools
Applying Color To HTML Elements Using CSS - MDN Web Docs
CSS: Even And Odd Rules - W3C
How To Change The Background Color Of An HTML Table - ThoughtCo
CSS/Table Styles/table Background Color - TAG Index
Liên Hệ
TRUYỀN HÌNH CÁP SÔNG THU ĐÀ NẴNG
Địa Chỉ: 58 Hàm Nghi - Đà Nẵng
Phone: 0904961917
Facebook: https://fb.com/truyenhinhcapsongthu/
Twitter: @ Capsongthu
Copyright © 2022 | Thiết Kế Truyền Hình Cáp Sông Thu