Guidelines for designing minimalist HTML tables

Looking to extract stripped HTML tables.

My desired output should resemble the following.

https://i.sstatic.net/J2qwI.png

Is there any technique to achieve this?

Thank you

td {
padding:5px;
border: solid black 1px;}

table {
border-collapse:collapse;}
<table>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
</tr>
<tr>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
</table>

Answer №1

Utilize both border-spacing and border-collapse in combination. See more details here

table {
  border-collapse: collapse;
}

th {
  background-color: green;
  Color: white;
}

th,
td {
  width: 150px;
  text-align: center;
  border: 1px solid black;
  padding: 5px
}

.geeks {
  border-right: hidden;
}

.gfg {
  border-collapse: separate;
  border-spacing: 0 15px;
}

h1 {
  color: green;
}
<table class="gfg">
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
  </tr>
  <tr>
    <td>4</td>
    <td>5</td>
    <td>6</td>
  </tr>
  <tr>
    <td>7</td>
    <td>8</td>
    <td>9</td>
  </tr>
</table>

Answer №2

Here is the code snippet for styling a table with alternating row colors:

td {
    padding:5px;
}

tr:nth-child(odd) td {
      border: solid black 1px;
}

table {
    border-collapse:collapse;
}

And here is an example of a table with three rows and three columns:

<table>
    <tr>
        <td>1</td>
        <td>2</td>
        <td>3</td>
    </tr>
    <tr>
        <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
        <td>4</td>
        <td>5</td>
        <td>6</td>
    </tr>
    <tr>
        <td colspan="3">&nbsp;</td>
    </tr>
    <tr>
        <td>7</td>
        <td>8</td>
        <td>9</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

Querying a table using Selenium, verifying a specific value within a row, and selecting a checkbox in that row if the value is detected

I am faced with a task where I have to cross-check a list of ID numbers against a website table. The objective is to identify if any row in the table corresponds to an ID number from my list, and then click on the checkbox associated with that particular r ...

Positioning elements to the left and right of each other with CSS: tips and tricks

I'm currently working on aligning these elements one below the other, with one on the left and the other on the right: Here is my code snippet: Check out the fiddle here: https://jsfiddle.net/ak9hxfpt/2/ I want to position the test2 to the right sid ...

Setting off an occurrence

On a specific website, there is a dropdown menu structured like this: <select class="categories-options" data-level="1" name="level1-option" id="level1-option" required=""> <option value="">default</option> <option value="p1" data ...

"Safari browser may hide placeholder text, making it invisible to viewers

When adding color to the placeholder, I utilize this CSS property: .pro_heading input::-webkit-input-placeholder { color: #777; } However, it appears that in Safari, the color is not visible. https://i.sstatic.net/hXmjX.jpg ...

Last item in Material UI Grid container not filling up entire space

I designed a Grid container with 2 Grid columns, each containing 3 elements. However, I am facing an issue where the last element of each column is not appearing at the bottom as intended. What could be causing this problem? For reference, you can view th ...

Customizing Carousel Arrows in Angular with ng-bootstrap

I need help changing the position and icon of control arrows using Bootstrap. I've tried targeting "carousel-control-prev-icon" & "carousel-control-next-icon", but nothing seems to work. Any suggestions on how to properly solve this issue? Here is th ...

What is the best way to conceal a menu after clicking on #links (links leading to sections on the same page)?

How can I hide my hamburger menu when any of the #links (same page links) are clicked or when someone clicks outside the menu area? I believe I need to modify my JS script, but I'm not sure which part needs changing. I am completely new to JavaScript. ...

What is the best way to retrieve upload progress information with $_FILES?

HTML: <input type="file" value="choose file" name="file[]" multiple="multiple"/><br/> <input type="submit" class="submit" value="confirm" /> <input type="hid ...

The issue with hiding elements using .setAttribute in HTML/CSS is not occurring as expected

function showEditStudentProfile() { document.getElementById('editstudentprofile').setAttribute('class', 'unhide'); document.getElementById('profile_viewStudent').setAttribute('class', ' ...

What is preventing me from adjusting the height of this DIV element?

I'm completely stumped by what's happening here. I've been trying to increase the height of a DIV element with an id of #titleStrip, but it just won't budge. It's beyond frustrating. I thought I knew my way around this kind of thin ...

5 Ways to Incorporate Font Awesome Icons into CSS Pseudo Elements

I'm attempting to incorporate FontAwesome icons into CSS pseudo elements. When I add the icon using HTML in the traditional manner, it works fine. However, I'm trying to integrate the fonts into a bootstrap accordion so that the icon changes whe ...

Tips for incorporating CSS 4 custom properties into Angular components

Exploring the new possibilities of CSS 4 with custom properties, my goal is to utilize them in Angular. Traditionally, custom properties are used in the following manner: <div style="--custom:red;"> <div style="background-color: var(--custom ...

Change the color of the border to match the background color

I have a parent container with a unique background color. Inside the parent container, there is an unordered list (ul) with multiple list items (li), each having a distinct color and a brighter border color. Now, I am looking to extract the border color of ...

"Identifying elements in CSS that do not have any adjacent text elements

I need help identifying a CSS selector that can differentiate between the <var> tags in these two distinct situations: <p><var>Foo</var></p> And <p>Some text <var>Foo</var> and more text</p> Specifi ...

Tips for excluding specific tags when creating an Xpath expression

My task involves writing an xpath to extract text from a specific element. The desired output is the text 1 Schools Found., excluding any text within the a tag. Although I have written an xpath for this purpose, I am unsure how to exclude or ignore the con ...

How can I implement 'blocked tails' using the :after pseudo-element?

Apologies, I'm uncertain of the right term for these elements. I have a module that reveals another box with information when hovered over. I want them to be visually connected by an angled rectangle or tail to indicate their association. Something a ...

What causes the inconsistency between Chrome's print CSS emulation and the Print Preview feature?

My website is based on Bootstrap 3 and ensuring that certain pages print properly is crucial for our customers. While most of the site prints fine, we are having issues with modal dialogs. I have been experimenting with Chrome's (v42.0.2311.135 m) CS ...

Guide to utilizing a download link for file retrieval in Python

I'm currently working on creating a script that can automatically download specific files from webpages and save them to designated folders. For the most part, I've been successful in achieving this using Python, Selenium, and FirefoxPreferences ...

WordPress Website Failing to Recognize @import Rule

Not really sure what's going on with the site layout, but it seems that in the style.css file, right at the beginning of the file, these two lines are not being recognized: @import "css/reset.css"; @import "css/layout.css"; It's strange because ...

Having trouble displaying a background image with CSS

When I open Chrome from my code editor (WebStorm), the header image shows up perfectly. However, after closing WebStorm and manually opening index.html from my project folder, the header image fails to load/display. The CSS for the background image is bac ...