What could be causing the columns in this table row to not display any borders?

On my HTML page, I have included an image which showcases a table. However, there seems to be an issue with the borders of the table - the vertical lines are not appearing as expected and instead showing around each button. Additionally, the horizontal lines are being cut between each cell, potentially due to margin settings. How can I ensure that the horizontal lines are continuous and the vertical lines display properly? Any insights into what may be causing this problem?

Below is the HTML code snippet:

<div id="wrapper">
</div>
<table>
<tr>
<td width="188px" class="button" ><img src="b2.png" /></td>

<td width="188px" class="button" ></td>
<td width="188px" class="button" ></td>
<td width="188px" class="button" ></td>
<td width="188px" class="button" ><img src="b1.png" /></td>
<td width="188px" class="button" ></td>
</tr>
</table>

Here is the corresponding CSS code:

.button {
    width:180px;
    text-align:center;
    background:rgb(51,153,51);
    position:relative;
    overflow:hidden;
    margin-top:1px;
      margin-bottom:1px;
        margin-left:1px;
        margin-right:12px;
    float: left; /* add this */
}

table td {

    margin: 0px 0px 0px 0px;
    padding: 0px 0px 0px 0px;
     border:1.0px solid #000;
}

Any assistance in resolving this issue would be greatly appreciated!

Answer №1

Your code has several issues that need to be addressed. The first problem is the use of float: left on .button, which affects all td elements and disrupts the table layout.

To fix this, you should remove the float property from .button and consider adding border-collapse: collapse to your table for better display.

Additionally, it's unclear if the table should be contained within the div.wrapper element or not.

For a visual demonstration, check out this Fiddle: http://jsfiddle.net/bDHW6/

Answer №2

While I don't have all the details, it seems like you're aiming for a specific table design. One suggestion is to apply border-collapse: collapse to achieve a seamless look by removing spacing between cells and merging their borders. Alternatively, if you prefer to keep both borders visible with some distance, consider using border-spacing: (distance).

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

Is it possible to directly load HTML files in R?

After creating 4 maps in R, I saved them as html files and then attempted to import them back into R. However, when trying to load these html files into a dashboard in R, the maps did not display correctly: https://i.sstatic.net/MGSDR.png I am seeking he ...

Issues are arising with the .mouseover functionality within this particular code snippet

Learning Javascript has been a challenge for me so far. I tried following a tutorial, but the result I got wasn't what I expected based on the video. I'm wondering why that is and how I can fix it. I'm aiming to make a box appear suddenly w ...

Adjust the input value with CSS when hovering

Whenever I click on a button, the name of that button is displayed on the site. However, I am looking to change this button name when hovering over it but I am not sure how to do it. echo '<form id="button" method="POST" >&ap ...

How can I redirect to a different URL when the dropdown selection changes?

<form action="myservlet.do" method="POST"> <select name="myselect" id="myselect" onchange="this.form.submit()"> <option value="1">One</option> <option value="2">Two</option> <option value="3"& ...

Issue with implementation of Foundation's 6-column grid system

Attempting to initiate a basic project using foundation 6. Here is the simple HTML utilized: <!doctype html> <html class="no-js" lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible"&g ...

I am looking for a pair of HTML tags that will allow one to be visible while the other is hidden, and then switch when needed

I am in the process of constructing a webpage dedicated to learning Japanese vocabulary. Each word will be presented within a sentence, just like the example shown below. 森林に散歩する take a walk in the forest In order to facilitate the practic ...

Show MySQL SELECT output on a HTML page

I have created a button that opens a new .html page in a new browser tab, allowing users to input data that is then stored in a MySQL database using a PHP script. Now, I am looking for a way to display the content of my MySQL database on my index.html fil ...

Having trouble with my phonegap app not allowing me to open any

I've just embarked on creating my first phonegap application using an HTML5 mobile website template. After deploying it, I noticed that the external links are not working within the app. Clicking on a link doesn't seem to do anything. To addres ...

Implementing text sliding effect upon hovering over an image using CSS

Is there a way to make text appear when hovering over an image, sliding in from the top and covering only 50% of the image height? Here's the code I have so far: <img style="background-color:#3b283e; float:left;" src="images/f1.jpg" /> <div ...

Utilizing Material UI's React framework for maintaining uniform grid column heights

Take a look at the image provided for context. I am facing an issue with two div elements, where one should occupy 20% of the total browser height and the other should take up 80%. Currently, I am utilizing Material UI Grid for positioning, which looks lik ...

What is the best way to build a personalized discussion platform: employing tables, <ul> <li>, <dl> <dt>, or div elements?

Looking to create flexible columns and rows with borders on the left and right of each column. If one row in a column stretches more, the other columns in that row should also stretch accordingly. Came across liquid 2 column layouts and 3 column layouts, b ...

When two rectangles are created at the same coordinates (x, y) in SVG, it results in an unexpected border appearing

.rect-x { fill: red; } .rect-y { fill: pink; } <svg viewBox="0 0 1024 768"> <rect class="rect-x" x="0" y="0" width="100" height="100"></rect> <rect class="rect-y" x="0" y="0" width="100" height="100"></rect> </svg& ...

Create an HTML table with a static header, adjustable columns, and the ability to resize to a width smaller than the content

Looking to create a unique web application with a table that has a fixed, styled header, resizable columns, and the ability to resize the columns without truncating content. Additionally, I want the body of the table to scroll if it cannot all fit on the p ...

Unleashing the power of JavaScript: Sharing arrays and data structures effortlessly

Currently, I am utilizing HTML & JavaScript on the client side and NodeJs for the server side of my project. Incorporated in my form are multiple radio buttons. When the user clicks on the submit button, my intention is to post the results to the server. ...

Out of the DIVs floating left and right, which one is positioned first?

Is the order of <div> elements in HTML important? If it is, what is the reason behind it? .float-left{float:left;} .float-right{float:right;} <div> <div class="float-left">Left</div> <div class="float-right">Right</ ...

The CSS property "text-decoration: none" doesn't appear to be functioning as expected

I have looked through many questions on StackOverflow, but I haven't been able to find a solution to this specific issue. Can someone help me understand why the code below is not functioning as expected? <pre style="text-decoration: underline;"& ...

The total sum of various divs containing a mix of numbers and letters

I have a group of div elements with the same class, each containing a value in the format (X1), (X2),... I need to add up these numeric values only, like 1 + 2 + .... Since these divs are generated dynamically, I won't know how many there will be. How ...

Adjust mouse coordinates to be relative to the coordinates of the <canvas> element

I'm currently facing the challenge of determining the exact location of the mouse on a canvas grid while still maintaining resizability. As of now, I have the mouse coordinates based on its position on the screen (x and y). The issue arises from the ...

Dynamically insert innerHTML content into table rows using JavaScript in PHP is a fantastic way to customize

Having trouble with innerHTML in this scenario, looking to achieve something along these lines: <table width="100%" border="0" id="table2"> <?php include("connection.php"); $sql=mysql_query("select* from b1"); while($res=mys ...

Leveraging Firebase in Electron Applications

I've been experimenting with integrating Firebase into Electron. However, I've run into a roadblock when trying to set it up similar to how I would on a regular web page. Since Electron pages are hosted locally and lack a hostname, the usual setu ...