Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. HTML Tables and CSS control

HTML Tables and CSS control

Scheduled Pinned Locked Moved Web Development
htmlcssdatabasemysqlarchitecture
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    OzWaz
    wrote on last edited by
    #1

    The Situation I am displaying data from MYSQL database into a HTML table on a web page. I am using CSS to display alternative rows in different text size and background colours. I am using the 'hover' function to change background colours and text size The Problem The 'hover' function works perfectly for the 'odd; rows however for the 'even' rows it will change the text size but not the background colour My CSS code

    table tbody tr:nth-child(odd) td {
    background-color: lightblue;
    }

    .table tbody tr:nth-child(even) td {
    background-color: lightgreen;
    }
    table tbody tr:hover td {
    background-color: white;
    transition: all .5s;
    font-weight:normal;
    font-size: 2.5em;
    color: black;
    border-right: 1px solid grey;
    }

    Solution: Can anyone spot the problem?

    Richard DeemingR P 2 Replies Last reply
    0
    • O OzWaz

      The Situation I am displaying data from MYSQL database into a HTML table on a web page. I am using CSS to display alternative rows in different text size and background colours. I am using the 'hover' function to change background colours and text size The Problem The 'hover' function works perfectly for the 'odd; rows however for the 'even' rows it will change the text size but not the background colour My CSS code

      table tbody tr:nth-child(odd) td {
      background-color: lightblue;
      }

      .table tbody tr:nth-child(even) td {
      background-color: lightgreen;
      }
      table tbody tr:hover td {
      background-color: white;
      transition: all .5s;
      font-weight:normal;
      font-size: 2.5em;
      color: black;
      border-right: 1px solid grey;
      }

      Solution: Can anyone spot the problem?

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Works fine for me in Firefox, Chrome, Edge, and IE11: Demo[^] The only slight issue is that the changing text size makes it very difficult to hover the next row accurately; as soon as the mouse leaves one row, its text size decreases, and the other rows shift up. It's easier to move in and out of the cells from the side.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      O U 2 Replies Last reply
      0
      • O OzWaz

        The Situation I am displaying data from MYSQL database into a HTML table on a web page. I am using CSS to display alternative rows in different text size and background colours. I am using the 'hover' function to change background colours and text size The Problem The 'hover' function works perfectly for the 'odd; rows however for the 'even' rows it will change the text size but not the background colour My CSS code

        table tbody tr:nth-child(odd) td {
        background-color: lightblue;
        }

        .table tbody tr:nth-child(even) td {
        background-color: lightgreen;
        }
        table tbody tr:hover td {
        background-color: white;
        transition: all .5s;
        font-weight:normal;
        font-size: 2.5em;
        color: black;
        border-right: 1px solid grey;
        }

        Solution: Can anyone spot the problem?

        P Offline
        P Offline
        Peter_in_2780
        wrote on last edited by
        #3

        OzWaz wrote:

        .table tbody tr:nth-child(even) td {

        Do you really want that leading "." ?

        Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

        O 1 Reply Last reply
        0
        • P Peter_in_2780

          OzWaz wrote:

          .table tbody tr:nth-child(even) td {

          Do you really want that leading "." ?

          Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

          O Offline
          O Offline
          OzWaz
          wrote on last edited by
          #4

          Yes. I think so? I have a number of tables on the one page and I only want the styling to apply to only one table. If i dont use the "class" option I found that it applies the styles to 'ALL' the tables Thanks you for taking the time to respond

          P 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            Works fine for me in Firefox, Chrome, Edge, and IE11: Demo[^] The only slight issue is that the changing text size makes it very difficult to hover the next row accurately; as soon as the mouse leaves one row, its text size decreases, and the other rows shift up. It's easier to move in and out of the cells from the side.


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            O Offline
            O Offline
            OzWaz
            wrote on last edited by
            #5

            Thanks for giving me some assistance. I have no idea why I had the problem but when I closed the browser cleared the cache and open it, it worked fine for me also. Clearing the Cache while open made no difference. Padding around the cells removes the issues you correctly identified on mouse over Thanks again

            W 1 Reply Last reply
            0
            • O OzWaz

              Yes. I think so? I have a number of tables on the one page and I only want the styling to apply to only one table. If i dont use the "class" option I found that it applies the styles to 'ALL' the tables Thanks you for taking the time to respond

              P Offline
              P Offline
              Peter_in_2780
              wrote on last edited by
              #6

              OzWaz wrote:

              If i dont use the "class" option I found that it applies the styles to 'ALL' the tables

              In which case, you might be missing the "." in the other two rules. It was the inconsistency I picked up on.

              Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

              O 1 Reply Last reply
              0
              • P Peter_in_2780

                OzWaz wrote:

                If i dont use the "class" option I found that it applies the styles to 'ALL' the tables

                In which case, you might be missing the "." in the other two rules. It was the inconsistency I picked up on.

                Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                O Offline
                O Offline
                OzWaz
                wrote on last edited by
                #7

                Thanks -Sharp eyes But the missing "." in both cases was a poor C&P effort by me. and interestingly noting should have worked - if the code was so flawed - I am increasingly amazed how browser development is progress in holding on to code when it ought to relinquish it - But that the future. As you will see the problem is solved but the mystery remains! Nice that you engaged in assessing my problem Thanks

                1 Reply Last reply
                0
                • Richard DeemingR Richard Deeming

                  Works fine for me in Firefox, Chrome, Edge, and IE11: Demo[^] The only slight issue is that the changing text size makes it very difficult to hover the next row accurately; as soon as the mouse leaves one row, its text size decreases, and the other rows shift up. It's easier to move in and out of the cells from the side.


                  "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

                  U Offline
                  U Offline
                  User 13709276
                  wrote on last edited by
                  #8

                  Hope this will be solved using right codes you get from online courses. They will provide you the exact code using for hover and text formats. Sometimes i have facing like this problems. But experts will make your work easier. https://channguyenvong.com/

                  1 Reply Last reply
                  0
                  • O OzWaz

                    Thanks for giving me some assistance. I have no idea why I had the problem but when I closed the browser cleared the cache and open it, it worked fine for me also. Clearing the Cache while open made no difference. Padding around the cells removes the issues you correctly identified on mouse over Thanks again

                    W Offline
                    W Offline
                    W Balboos GHB
                    wrote on last edited by
                    #9

                    If you don't, already, when refreshing a page under development, use Ctl=F5 (at least in firefox) to force reload without the cache. There are also methods to add a header that forces uncached reloads for all - which at times can be handy.

                    Ravings en masse^

                    "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                    "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups