How do I override the style background color?

Max

I was doing this xsl file and was trying to create a weather where the top header need to have a different color than the background color but the style color keeps overriding the given color instead. Is there a way to rectify this issue?

<style> <!--background color of blue and green-->

        tbody>tr:nth-child(odd){
        background-color: blue; }
        
        tbody>tr:nth-child(even){
        background-color: green; }
        </style>
  </head>
  <body>
    <h1> <xsl:value-of select="@qLocation"/> 
          [<xsl:value-of select="@qTime"/>] </h1>


    <table border="1" style="border:1px solid black;">
        <tr >  
            <th style="background-color:orange">Date</th> <!--this color should appear as orange but is overridden by the style-->
            <th>Weather data</th>
            <th>Highest</th>
            <th>Lowest</th>
        </tr>
sergey kuznetsov

Your problem was referring to th tags in the css. You specified like this:

tbody>tr:nth-child

And it was necessary like this:

tbody>tr th:nth-child

The tbody tag was also missing in your html structure.

tbody>tr th:nth-child(odd){
        background-color: blue; }
        
tbody>tr th:nth-child(even){
        background-color: green; }
<table border="1" style="border:1px solid black;">
    <tbody>
        <tr>  
            <th style="background-color: orange">Date</th>
            <th>Weather data</th>
            <th>Highest</th>
            <th>Lowest</th>
        </tr>
     </tbody>
</table>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I change the background color with JavaScript?

How can I override the default mousepressed background color of all JButtons into a darker shade of its current background color?

How do I change the background color of a QtQuick Window?

How do I change the background color of the body?

How do I change the background color of a unicode symbol?

How do I style a ttk.LabelFrame, specifically the background color?

How do I override div style:background-color with class?

How to override background color for disabled JPanel

How do I make the screen ignore the background color of some image?

How do I set the window background color using curses and Python?

How do I change a background color in JS?

How do I change the background color in JavaScript?

How do I change the background color of a tabbed page in Xamarin iOS?

How do I make a color background in java

How do I change the entire background color in an RMarkdown HTML Document?

How do I set combobox's background color on selected item?

How do I change the xubuntu start menu color and style?

How do I set the background color of a Highcharts HTML label?

How do I set the background color of the editing accessory of a table view?

Joe 4.6: How do I override color definitions?

How do I change the highlight color style of the code in the IPython(Jupyter)?

How do I set the background color of a readonly textbox in Winforms?

How do I change button background and text color?

how do I change my header background color?

How do I override component style written with SCSS in React

How do i change input field background color based on onclick?

how do I change or override a antd element style

how can i replicate this background texture and color style in SwiftUI?

How do I match the background color of my HTML email to the background color of the email client?