The height of a table cell in MVC cannot be altered

Could someone please help me with changing the height of table cells in MVC using Dreamweaver? I have already created the table with the following structure, but I am struggling to adjust the cell height. Any advice or tutorials would be greatly appreciated. Thank you!

jsfiddle

HTML

    <table class="table">
    <tr>
        <th>
            First Name
        </th>
        <th>
            Last Name
        </th>
        <th>

        </th>
        <th>Edit</th>
    </tr>



        <tr>
            <td>
              jgfjfgj jjjjjjjjjjjjjjjjjjjjjjjjjj   jgfjfgj jjjjjjjjjjjjjjjjjjjjjjjjjj   jgfjfgj jjjjjjjjjjjjjjjjjjjjjjjjjj
            </td>
            <td>
              jgfjjjjjjjjjjjjjjjjjjj
            </td>
            <td>
            fgjfjjjjjjjjjjjjjjjjj
            </td>
            <td>
               gjj jjjjjjjjjjjjjjjjjjjjjjjjjj
            </td>
        </tr>


</table>

css

@media 
    only screen and (max-width: 560px),
    (min-device-width: 768px) and (max-device-width: 1024px)  {

        /* Force table to not be like tables anymore */
        table, thead, tbody, th, td, tr { 
            display: block;  width:250px;
        }

        /* Hide table headers (but not display: none;, for accessibility) */
        thead tr { 
            position: absolute;
            top: -9999px;
            left:-9999px; 
        }

        tr { margin-left:4px; }



        /*
        Label the data
        */
        td:nth-of-type(1):before { content: ""; }
        td:nth-of-type(2):before { content: ""; }
        td:nth-of-type(3):before { content: ""; }
        td:nth-of-type(4):before { content: ""; }
        td:nth-of-type(5):before { content: ""; }

        }

   /* Smartphones (portrait and landscape) ----------- */
    @media only screen
    and (min-device-width : 320px)
    and (max-device-width : 480px) {
        body { 
            padding: 0; 
            margin: 0; 
            width: 320px;  }
        }

    /* iPads (portrait and landscape) ----------- */
    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
        body { 
            width: 495px; 
        }
    }tr:nth-of-type(odd) { 
        background:#eee;
    }
    th { 
        background: #333; 
        color: white; 
        font-weight: bold; 
    }
     th { 
        padding: 5px; height:10px; 
        border: 1px solid #ccc; 
        text-align: left;
    }
td {
height:5px;
        border: 1px solid #ccc; 
        text-align: left;



}

    Edit { color:black;}

Answer №1

If you're looking to style your table for different screen sizes, consider using the following CSS code:

  @media 
  only screen and (max-width: 560px),
  (min-device-width: 768px) and (max-device-width: 1024px)  {
  
    /* Adjust table display for smaller screens */
    table, thead, tbody, th, td, tr { 
      display: block;  width: 250px; box-sizing: border-box;
    }
    
    /* Visually hide table headers without removing them from the DOM */
    thead tr { 
      position: absolute;
      top: -9999px;
      left: -9999px; 
    }
    
    /* Add some margin to the rows */
    tr { margin-left: 4px; }
       
    
  
    /*
    Label the data
    */
    td:nth-of-type(1):before { content: ""; }
    td:nth-of-type(2):before { content: ""; }
    td:nth-of-type(3):before { content: ""; }
    td:nth-of-type(4):before { content: ""; }
    td:nth-of-type(5):before { content: ""; }
    
    }

   /* Style adjustments for smartphones in portrait and landscape mode */
  @media only screen
  and (min-device-width: 320px)
  and (max-device-width: 480px) {
    body { 
      padding: 0; 
      margin: 0; 
      width: 320px;  
    }
    }
  
  /* Style adjustments for iPads in portrait and landscape mode */
  @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    body { 
      width: 495px; 
    }
  }
  
  tr:nth-of-type(odd) { 
    background: #eee;
  }
  
  th { 
    background: #333; 
    color: white; 
    font-weight: bold; 
  }
  
  th { 
    padding: 5px; 
    min-height: 10px; 
    border: 1px solid #ccc; 
    text-align: left;
  }
  
  td {
    min-height: 5px;
    border: 1px solid #ccc; 
    text-align: left;
  }

  Edit { color: black; }
</style>
<table class="table">
    <tr>
        <th>
            First Name
        </th>
        <th>
            Last Name
        </th>
        <th>
            
        </th>
        <th>Edit</th>
    </tr>
  
    <tr>
        <td>
          Example text
        </td>
        <td>
          More text
        </td>
        <td>
          Even more text
        </td>
        <td>
          Additional text
        </td>
    </tr>
  </table>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having issues with handling button click events in jQuery

I'm currently working with jQuery to show a div when a button is clicked, but for some reason, it's not functioning as expected... HTML: <input type="button" id="addmoresg" value="Add More" name="button"> <div id="addsg" style="display ...

List containing ionic items that spans the full height

I am trying to create a full-height list in Ionic that will always have 3 items. I want to ensure that it displays as full screen on different screen sizes. I have attempted using height:100%, but have not had success. Here is an example of what I am tryin ...

Is there a way to make smaller svg images align side by side instead of wrapping or being pushed to the next line?

I am trying to display 6 svg images side by side in a row, but I am encountering some layout issues. The images have varying widths, but the same height. I have used the height property to scale them proportionally. However, the image container is taking ...

Colorbox scalePhotos function malfunctioning

The scalePhotos option in Colorbox does not seem to be working correctly for me. I have tried various methods to set it, including initializing Colorbox using the following code snippet right before the closing </body> tag in my HTML: jQuery('a ...

Click to alter the style of an <li> element

I'm currently using Angular CLI and I have a menu list that I want to customize. Specifically, I want to change the background color of the <li> element when it is clicked. I am passing an id to the changeColor() function, but unfortunately, I a ...

Issues with card flip functionality in Firefox

I designed this animation specifically for my website to create a unique effect. The animation involves translating on the Z-axis, making it appear as though the object is getting smaller, flipping to reveal the back of the card, and then translating back. ...

The hover effect becomes disabled once the slider is toggled

My table has a feature where I can change the background color and other elements using a slider. However, I'm facing an issue where the hover effect on the table stops working when I toggle the slider on or off. I attempted to solve this with a funct ...

Error: Invalid Argument - The argument 'PanelController' is expected to be a function, but it is undefined

Here is a snippet of my HTML code: <body ng-controller="StoreController as store"> ........... <section ng-controller="PanelController as panel"> <ul class="nav nav-pills""> <li ng-class="{active:panel.isSe ...

Need help restarting a timer I've built in Angular with just a click?

I am in the process of developing a compact application that will help me keep track of my activities within a specific time frame. Once I input an activity into a field and click "OK," it should be added to a list. My current challenge lies in resetting ...

Is there a way to automatically update the child option when the parent option is altered?

I am attempting to modify the child option based on the parent option selection, similar to how it works in Bootstrap. ` <div class="wrap-input100 input100-select bg1"> <span class="label-input100">Indus ...

Learn the position of a div element that appears following the lazy loading of images

I am struggling to make a div sticky below a set of lazy load images. The issue lies in the fact that the offset of the div keeps changing due to the lazy loading images pushing it down. There are 4 images with unknown heights, making it difficult to acc ...

Tips for coordinating external asynchronous JavaScript retrieval

Within my app.js file, I have the following code snippet: load(src) { var script = document.createElement('script'); script.src = src; script.async = true; document.head.appendChild(script); } for (var i=0; scripts.length; i++) { loa ...

Use of number type input on mobile devices in HTML

My goal is to display the up/down arrows alongside an input element with type="number" in Chrome on Android. I've adjusted the CSS to set opacity=1, but unfortunately, they are not appearing. On desktop, however, they show up without any iss ...

The feature for choosing rows is not functioning properly when using materializecss in Tabulator

While working on my project, I encountered an issue with selecting rows. After some debugging, it was revealed that the culprit behind this behavior is the tabulator_materialize.min.css file. Interestingly, when I don't use this CSS, everything functi ...

What is the best way to trigger a JavaScript function to execute as soon as the innerHtml has been modified via Ajax

Utilizing Ajax to dynamically update the content of a div upon clicking a link is my current project. I am seeking guidance on how to call a JavaScript function once the file has been retrieved from the server and the div's content has been replaced. ...

Error encountered in ngtsc(2345) where an argument of type 'Event' is being used instead of an expected parameter type of 'SortEvent'

I recently started using angular and encountered an issue while trying to sort columns. The error message I received was: Argument of type 'Event' is not assignable to parameter of type 'SortEvent'. Type 'Event' is missing t ...

variable identifier looping through elements

I'm attempting to assign a dynamic ID to my div using ng-repeat. Here's an example: <div id="$index" ng-repeat="repeat in results.myJsonResults"> <div id="$index" ng-click="saveID($index)" ng-repeat="subRepeat in results.myJsonResul ...

Trying to display logo using 'content' property in CSS

I've been trying to display a logo on the header of my website, but I'm having trouble getting it to show up. I attempted to set the logo using HTML syntax as well as the following CSS code: .div { content: url (...jpg); } However, both metho ...

hierarchical browsing system

Take a look at the image provided below. Currently, I am using multiple unordered lists - specifically 5. However, I would prefer to consolidate them all into a single nested ul. I am encountering two issues: How can I add a border-bottom to the hori ...

String constant without an ending

My Description has a single quote character('). How can I make sure it doesn't break the code? <a href='javascript:select("<%= pageBean.replace(list.getColumn(0), "'", "'") %>", "<%= pageBean.replace(list.getColumn(1), ...