What is the best way to fill a single row with a solid color and no border?

It's table time!

 <table class="custom-table">
      <tr>
          <td>231232131</td>
           <td>INTERNATIONAL FEDERATION O</td>
      </tr>
 </table>

I'm aiming for a row with some color, like #eee;

Currently, with this CSS:

tr{
 background:#eee;
}

I get the gray row I want, but there's white space between the cells. If I try:

table{
background:#eee
}

Then I lose that space between the rows. Any ideas on how to fix this?

Answer №1

If you want to control the borders of a table, consider using the border-collapse property.

According to information from MDN:

The border-collapse CSS property determines whether a table's borders are separate or collapsed. In the separated-border model, each cell has its own distinct borders. In the collapsed-border model, adjacent cells share borders.

table {
  border-collapse: collapse;
}

tr {
  background: #EEE;
}
<table class="custom-table">
  <tr>
    <td>231232131</td>
    <td>INTERNATIONAL FEDERATION O</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

What are some ways to customize the appearance of a mat-snack-bar template with CSS in Angular Material 7?

I have browsed through various answers, but none of them seem to fully address my specific issue. For instance, this particular answer provides guidance on changing the background color of a snack-bar using CSS, which is helpful. However, attempting to adj ...

Activate just the show more / show less button on the website that has several buttons with identical ids

Whenever the "show more" button is clicked, additional images are displayed in the gallery and the button text changes to "show less". However, in my ExpressionEngine (CMS) templates and entries, all "show more" buttons share the same id, causing other but ...

Rotating and scaling an image simultaneously using CSS3

I am feeling very puzzled. Why am I unable to simultaneously scale and rotate? Despite my attempts, it seems to be not working: .rotate-img{ -webkit-transform:scale(2,2); -webkit-transform:rotate(90deg); margin-left:20%; margin-top:10%; } ...

Tips for encapsulating an image generated using execCommand

<input type="button" onclick="document.execCommand('insertimage',null,'http://barwoncopiers.com/wp-content/uploads/2011/03/linkedin-icon-45x45.jpg');" value="Img"/> <br> <div contenteditable="true" class="editor" id="edit ...

Unlawful CSS Selector

Wanting to utilize this particular CSS selector in conjunction with Selenium webdriver #coordinatonTable .odd:not(:has(.dataTables_empty)) Encountering an "An invalid or illegal string was specified" error. I've attempted the jquery selector test fr ...

Tips for efficiently webscraping multiple pages with Beautiful Soup

I have been running my web-scraping script for quite some time, but it seems to be stuck on scraping only one URL. I intend to scrape five different URLs, and I am wondering if the issue lies with my loop getting stuck in an infinite loop. Furthermore, I ...

Update the text within a textarea by clicking with the power of jquery

Is there a way to clear the content of my textarea on click? Below is the code snippet: http://jsfiddle.net/QMfyP/ <textarea name="adventage" style="width:400px; border-radius: 3px; border-left: 4px solid #6C3" id="adventage" cols="45" rows="5">Sh ...

Center the title vertically APEXCHARTS

I created this chart using Apex charts https://i.sstatic.net/j34Wc.png However, I am facing an issue where the 'Chart' title and caption are not properly aligned. The title should align with the graph horizontally, and the caption vertically. ...

Selenium failed to locate the element that already exists

I have developed an application that utilizes the Selenium Internet Explorer webdriver. The program functions properly on my own computer, however, when attempting to run it on another PC with the same driver, an exception is thrown regarding the inability ...

Customizing Material-UI Grid: Is it possible to assign a background color solely to the cells, without affecting the surrounding empty spaces?

I've been experimenting with designing a grid system that incorporates a gradient background color. The issue I'm facing is that the background color extends to the empty spaces between the grid cells as well. Is there a way to scope the gradient ...

I have an array containing the paths of multiple images, and I am looking to display these images using a loop

I am working with an array that contains paths to multiple images, and I need to display these images on my HTML page. function showImages() { var images = ["1.jpg", "2.jpg", "3.jpg", "4.png"]; for (var i = 0; i < images.length; i++) { ...

Struggled with controlling labels and fields in bootstrap framework

Struggling with a bootstrap template, I found it difficult to adjust the size and alignment of labels and input fields. Here are images showing what I currently have and what I aim for. Despite checking out the grid system documentation at here, I couldn&a ...

What is the best way to randomly display an image from a JavaScript array within an HTML document?

I currently have this code in my HTML and JavaScript files, but I am having trouble with displaying images without using a URL in the JavaScript file. The images are located in my project folder. However, when I open the HTML file, the images do not appear ...

Adding additional information to the HTML5 doctype is indeed achievable

Imagine you have a set of IE conditional comment tags in the beginning of your HTML document: <!--[if IE 6]><html class="no-js ie6" lang="en" ><![endif]--> <!--[if IE 7]><html class="no-js ie7" lang="en" ><!--<![endif]- ...

Enhance your website with a dynamic navigation menu created with the power of html5

Currently in the process of designing a mobile website, I am facing a specific challenge. The homepage features menu items labeled 'a', 'b', 'c', ..., 'h'. My goal is to initially display only the first three menu it ...

Steps for building an HTML tree

Exploring HTML files can be daunting, especially for someone with limited experience in this field. I am seeking assistance to transform these files into a more readable format, represented as a tree structure with each tag on a separate line. However, des ...

When the height of a LightSwitch HTML root screen layout is set to "stretch to container," it can extend beyond the screen boundaries, causing potential display issues

Hello everyone, I've encountered a layout issue where setting the root layout's height to "Stretch to Container" while ensuring that no buttons are visible in the footer causes the page to unnecessarily extend beyond the browser window's he ...

CSS: Navigation menu causing a delay in the display of a div

Hey there, I am a beginner in HTML & CSS and currently working on my first website. I'm facing an issue with my navigation bar causing a delay in the div below it when set to relative position. When I switch it to absolute positioning, the centering o ...

Show an image based on a query parameter

Currently, I am developing a PHP project and I am facing an issue with loading an image from a query string. Here is the code snippet I am using: <img src="load_image.php?name=Profile_Photo_Small" /> Is there anyone who can help me out with this pro ...

Tips for concealing the currently playing track title on a media player

I'm looking for a way to conceal the track title displayed in the media player on Internet Explorer. Here's the code I currently have: <object id="mediaPlayer" width="320" height="240" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type ...