CSS: The cell borders seem to have lost their rounded corners inexplicably

I am having trouble creating a navigation bar with rounded borders on the end cells. Despite seeing some rounding in the background, the borders remain stubbornly sharp at the corners.

You can view the issue here: http://jsfiddle.net/7veZQ/299/

Below is the code I have used:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
table {
    border-collapse: collapse;
    border: none;
    box-shadow: 0px 5px 10px #BBB;
}
.nav tr td {
    width: 160px;
    height: 40px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    color: #666;
    border: 1px solid #999;
    vertical-align: middle;
    text-align: center;
    background: #eeeeee; /* Old browsers */
    background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
    background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
    text-shadow: 1px 1px 0px #FFFFFF;
    letter-spacing: 3px;
}
.nav tr td:hover {
    background: #F4F4F4; /* Old browsers */
    background: -moz-linear-gradient(top, #F4F4F4 0%, #E0E0E0 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F4F4F4), color-stop(100%,#E0E0E0)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #F4F4F4 0%,#E0E0E0 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #F4F4F4 0%,#E0E0E0 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #F4F4F4 0%,#E0E0E0 100%); /* IE10+ */
    background: linear-gradient(to bottom, #F4F4F4 0%,#E0E0E0 100%); /* W3C */
}
.nav tr td#first {
    border-radius: 5px 0px 0px 5px; 
    -moz-border-radius: 5px 0px 0px 5px; 
    -webkit-border-radius: 5px 0px 0px 5px;
}

.nav tr td#last {
    color: #09C;
    border-radius: 0px 5px 5px 0px; 
    -moz-border-radius: 0px 5px 5px 0px; 
    -webkit-border-radius: 0px 5px 5px 0px;
}
</style>
</head>
<body>
<table class="nav" width="960" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td id="first">Home</td>
    <td>Options</td>
    <td>Prices</td>
    <td>Showcase</td>
    <td>Help</td>
    <td id="last">Order Now!</td>
  </tr>
</table>

</body>
</html>

If you could offer any guidance on what might be causing this issue, it would be greatly appreciated.

Answer №1

Why isn't my design working?

Utilizing tables for design layout.

Tables should not be used for layout purposes. Certain browsers may not render rounded corners on table cells correctly. If you have a list of data, consider using list markup instead.

Answer №2

Update the css styling for your table to

border-collapse: separate;

Answer №3

Unfortunately, some CSS properties may not be compatible across all browsers as CSS3 support varies. I recommend making a few adjustments to improve the overall compatibility and flexibility of your code. Firstly, avoid using fixed heights and widths whenever possible.

Secondly, consider using DIV elements instead of relying on tables for layout purposes. Here's an insightful forum post explaining why...

Below is a suggested "fix," even though personally I prefer not to float elements excessively:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
.nav {
    float:left;
    width:960px;
    height:40px;
    border: 1px solid #999;
    border-radius: 5px; 
    -moz-border-radius: 5px; 
    -webkit-border-radius: 5px;
    box-shadow: 0px 5px 10px #BBB;
}
.nav a {
    float:left;
    display:inline-block;
    margin:0;
    padding:0;
    line-height:40px;
    text-decoration:none;
    width: 160px;
    height: 40px;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    color: #666;
    text-align: center;
    background: #eeeeee; /* Old browsers */
    background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
    background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
    text-shadow: 1px 1px 0px #FFFFFF;
    letter-spacing: 3px;
}
.nav a:hover {
    background: #F4F4F4; /* Old browsers */
    background: -moz-linear-gradient(top, #F4F4F4 0%, #E0E0E0 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#F4F4F4), color-stop(100%,#E0E0E0)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #F4F4F4 0%,#E0E0E0 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #F4F4F4 0%,#E0E0E0 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top, #F4F4F4 0%,#E0E0E0 100%); /* IE10+ */
    background: linear-gradient(to bottom, #F4F4F4 0%,#E0E0E0 100%); /* W3C */
}
.nav a#first {
    border-radius: 5px 0px 0px 5px; 
    -moz-border-radius: 5px 0px 0px 5px; 
    -webkit-border-radius: 5px 0px 0px 5px;
}

.nav a#last {
    color: #09C;
    border-radius: 0px 5px 5px 0px; 
    -moz-border-radius: 0px 5px 5px 0px; 
    -webkit-border-radius: 0px 5px 5px 0px;
}
</style>
</head>
<body>

<div id="main-menu" class="nav">
    <a href="#" id="first">Home</a>
    <a href="#">Options</a>
    <a href="#">Prices</a>
    <a href="#">Showcase</a>
    <a href="#">Help</a>
    <a href="#" id="last">Order Now!</a>
</div>

</body>
</html>

These adjustments should enhance cross-browser compatibility while offering more versatility. If you encounter difficulties with CSS layouts, consider exploring YUI3 Grids as a viable solution. As a personal recommendation, I am partial to YUI 3 and its capabilities.

Learn more about the YUI Library here

Answer №4

Check out this transformation:

http://example.com/transformation

This code snippet converts a table into nested divs and lists.

Take note of the line-height property, used to vertically center text.

I have also updated the use of first and last as classes instead of ids for better practice regarding uniqueness in document structure.

Lastly, observe how the borders are applied differently due to the absence of border-collapse in lists.

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

Arranging HTML elements with jQuery - the existing script flips back and forth

I have created a code snippet on CodePen that showcases a feature of the website I am currently developing: http://codepen.io/barrychapman/pen/BzJGbg?editors=1010 Upon loading the page, you will notice 6 boxes. The first box is active, while the remaining ...

What could be causing the alignment issue with cells in Bootstrap?

I'm currently facing an issue with Bootstrap where two columns that are supposed to appear side-by-side on medium resolution end up displaying one below the other. You can view a screenshot of the problem here, and the code can be found at this link. ...

Error alert: The $ symbol is not defined

I followed a tutorial to create an auto-advancing slideshow in JavaScript/jQuery and it worked perfectly on jsfiddle. However, when I transferred everything to Dreamweaver, it stopped functioning. I have triple-checked that all the necessary files are link ...

The dimensions of the images in the Bootsrap carousel are fluctuating

Check out this carousel design with a login screen form here. The carousel in the link above is experiencing issues with changing sizes for each image. I've attempted to adjust the width and height of the carousel-inner, carousel, and img elements wi ...

Select a picture at random from a directory

As a student embarking on an art project, I am in the process of selecting one out of 500 images to display on a webpage. My coding knowledge is quite limited, primarily focused on HTML and CSS, with only a basic understanding of JavaScript. I am encounter ...

What is the best way to create a reset button for a timing device?

Is there a way to reset the timer when a button is clicked? Having a reset button would allow users to revisit the timer multiple times without it displaying the combined time from previous uses. Check out this code snippet for one of the timers along wit ...

Is it possible to use jQuery for drag-and-drop functionality?

Currently, I am working on developing a drag-and-drop widget that consists of 3 questions and corresponding answers. The user should only be able to fill in 2 answers in any order, while the third drop area should be disabled. This third drop area can be l ...

Elements in Internet Explorer become unresponsive after being hidden or shown using jQuery

One issue I'm encountering is with a group of tabbed divs that I'm using jQuery hide() and show() to toggle the visibility. This method functions perfectly in most browsers, but unfortunately in Internet Explorer (IE), the hidden tabs become unre ...

Using HTML Character Encoding to support UTF-8 Formats

In the midst of developing a website for a client in Brazil, there is a section on the site dedicated to displaying feedback and reviews from users. For instance: Expected Version: "Três aprovados em menos de dois minutos!" However, when it appears to ...

Executing the Javascript function specified above upon the page being loaded

I'm fairly new to JavaScript, so please bear with me. I've got a JavaScript function on my page: <script type="text/javascript"> Sys.debug = true; var popup; Sys.require(Sys.components.popup, function () { popup = Sys.c ...

Understanding how to sum the values of two separate dropdown selections using jQuery

Is it possible to combine and total up two different selections to display on the "Total" button below? I have added calculations to each selection. When a user selects a quantity, it should automatically sum up and display on the "Total" button, but I am ...

There is currently no graph being shown

I've run this code but I'm not getting any output. There are no errors showing up, but I can't seem to figure out what's wrong. Can someone help me identify the issue? Thanks! <!DOCTYPE html> <html> <head> <m ...

Grab onto a nested section

What is the solution for targeting the h2 span element? div#content div.view-content div.view-row-item h2 span { ... doesn't seem to be doing the trick... ...

What is the best way to implement this (click) function in Angular?

My goal is to create a set of three buttons with a (click) function attached to each. Initially, when the page loads, the first button should be selected while the other two are unselected. If I click on an already selected button, it should remain selecte ...

Struggling with overlaying Bootstrap modals on top of each other

This idea is inspired by the topic Multiple modals overlay I am working on developing a folder modal that allows users to either 1) open an existing file or 2) create a new file within each folder modal. To see how it functions, please run the code below ...

Design a custom screensaver using jQuery that includes a timed delay feature and an alert message

I am currently working on implementing a screensaver feature for my website. Here is the breakdown of what I am trying to achieve: When detecting the onload, clicks, and touches, I want to start a timer that counts 5 seconds. If any of these events are d ...

Having trouble with playing the appended HTML5 Video?

Having trouble getting a video player to display after clicking a button. This is the code I use to add the video player in index.html: $("#videoContainer").append( "<video id=\"video-player\" width=\"100%\" height ...

PHP is unable to properly process JSON data that contains HTML tags

I'm encountering an issue with my website that communicates with a Java REST server using Jersey. Everything is functioning properly except when I try to receive a JSON object with HTML tags embedded in the content. After running a println statement ...

Displaying dropdown options based on the previous selection made by the user

Can I link the data in my second dropdown to the selection made in the first dropdown? I tried a similar solution from stackoverflow without success. You can find the reference here. The code works when directly copied and pasted but not within my system. ...

What is the best way to style a select element to achieve this appearance?

https://i.sstatic.net/4yGqf.png Currently working on converting a .psd file to html/css and encountering difficulty with a unique looking select element. Struggling to find a suitable example online for reference. Wondering if this design element is indee ...