Ways to assign a color attribute to the top and bottom borders of a row

Click here for the image

Can anyone help me figure out how to add color to just the top and bottom border lines of each row, while disabling the side colors? The attached picture shows what I am aiming for.

Answer №1

Utilize border-bottom/top (indicando uma borda apenas para o top e bottom)

td, th {
    border-bottom: 1px solid #dddddd;
    border-top: 1px solid #dddddd;
}

Aprenda mais em:https://www.w3schools.com/css/css_border.asp

Veja um exemplo:

table {
    font-family: arial, sans-serif;
    border-collapse: collapse;
    width: 100%;
}

td, th {
    border-bottom: 1px solid #dddddd;
    border-top: 1px solid #dddddd;
    text-align: left;
    padding: 8px;
}
<table>
  <tr>
    <th>Empresa</th>
    <th>Contato</th>
    <th>País</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Alemanha</td>
  </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>México</td>
  </tr>
  <tr>
    <td>Ernst Handel</td>
    <td>Roland Mendel</td>
    <td>Áustria</td>
  </tr>
  <tr>
    <td>Island Trading</td>
    <td>Helen Bennett</td>
    <td>Reino Unido</td>
  </tr>
  <tr>
    <td>Laughing Bacchus Winecellars</td>
    <td>Yoshi Tannamuri</td>
    <td>Canadá</td>
  </tr>
  <tr>
    <td>Magazzini Alimentari Riuniti</td>
    <td>Giovanni Rovelli</td>
    <td>Itália</td>
  </tr>
</table>

Answer №2

When it comes to borders on a DIV element:

border-top: 1px solid Green;

border-bottom: 1px solid Green;

I trust this information proves useful.

Answer №3

If you're looking to change the border color of a div element, you can try using the following CSS code:

.myDiv {
border-top-color: red;
border-bottom-color: red;
}

By applying this CSS rule, the top and bottom borders of your div will be red in color. Hopefully, this resolves any questions or concerns you may have had.

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

Determine the appropriate height of a video container based on its aspect ratio

Imagine a scenario where I have a service that either returns an error or a video URL to be played. If a video is present, React will display the video; if not, it shows the error message. I want to ensure that there is always a placeholder/error message w ...

CSS rule for elements in a disabled state

Currently, I am utilizing AngularJS to manage the enabling and disabling of image buttons. Despite my attempts to use a CSS selector to display them as transparent once disabled, it is not working as expected. While testing with a provided example that app ...

Hover functionality for the border animation is disabled, but the SlideToggle feature is operating smoothly

I am interested in changing the right border color of a DIV when another one is hovered over. I had to use a unique solution to make slideToggle work, so I assume this will require a different approach as well. Below is the detailed code: $(document).rea ...

Issue with Google Maps: undesired change in map size

Welcome to my app! Check out the link to my app here: http://jsbin.com/axeWOwAN/1/edit If you prefer a full-screen view, click here: http://jsbin.com/axeWOwAN/1 I'm encountering an issue with the map on the second page of my app. The map works perf ...

Adjust the width of table columns with headers

Check out the HTML code on jsfiddle.net as it's too lengthy to post here. I'm having trouble figuring out how to change the width of a column. Specifically, I want to make the "Produkt" column wider. ...

Tips for automatically breaking or paginating HTML in order to ensure that the resulting PDF mirrors the paginated HTML layout

I'm looking to implement a feature that automatically breaks or paginates HTML content in order to ensure that the resulting PDF matches the appearance of the original HTML. Requirement: If HTML content exceeds the size of an A4 paper, it should be s ...

issue with HTML forms not triggering correct function when submitted

UPDATE: I have encountered an issue with my HTML page containing two forms, each with a single submit button. I attempted to call a specific function when the submit button is pressed. To achieve this, I included two <script> tags to handle the butto ...

A total of 12 columns within the Foundation grid layout, with ample space for customization

My layout structure is as follows: <div class="row"> <div class="columns small-12 large-6 medium-12 panel-wrapper"> Box no 1 </div> <div class="columns small-12 large-6 medium-12 panel-wrapper"> Box n ...

Resizing objects within a section to conform to the section's dimensions is not possible in CSS/HTML

I'm facing some challenges with responsiveness on my landing page. Utilizing the scrollify jQuery library, users can skip between different sections of the landing page on click or scroll. However, when switching to landscape orientation on mobile d ...

Local images are visible, but not when they are hosted

I created a menu component html (src/menu/menucomponent) that displays images from a folder (src/assets/images/image.png) for the main navigation when viewed on a computer. Additionally, I have a side navigation that is displayed on mobile devices. Here i ...

Using a mix of filters with Jquery Isotope

I am struggling to merge filters in a similar manner to this example: http://codepen.io/desandro/pen/JEojz/?editors=101 but I'm facing difficulties. Check out my Codepen here: http://codepen.io/anon/pen/gpbypp This is the HTML code I'm working ...

What's causing my struggle to override the bootstrap nav-link class in next.js?

I am facing an issue where I need to customize the active state of bootstrap .nav-link in the code snippet below: <li className="nav-item"> <a className={`${styles.navLink} nav-link`} role="tab" data-to ...

Transfer the browserify process into a specific gulp task that includes vueify, browserify, and babelify

I am in the process of transitioning the existing browserify workflow into a single gulp task: package.json: "scripts": { "build": "browserify src/main.js > dist/build.js" }, ... "browserify": { "transform": [ "vueify", "babelify" ] } . ...

Retrieve all CSS properties associated with a specific DOM element, similar to the functionality provided by Firebug

Is there a method to retrieve all the CSS styles specified for a specific DOM element? Do I need to iterate through all the CSS style names? Could there be a more sophisticated approach? How exactly does Firebug achieve this task? Appreciate any insights ...

Resources for ExpressJS

New to ExpressJS and trying to figure out how to reference images stored in the /public/images/ directory in my /public/stylesheets/styles.css The code snippet below doesn't seem to be working for me: .home-bg { background-image:url('../ima ...

Is it possible to integrate MySQL directly with Vue SSR without relying on a REST API backend?

In order to streamline the process of fetching content during server side rendering, I am considering using MySQL directly as the data source. This would eliminate the need for an additional API server solely dedicated to retrieving data from the databas ...

Unconventional appearance of WordPress Jetpack sharing buttons on unique custom theme

Currently, my wordpress blog has a unique theme and is powered by Jetpack. I've activated Sharing and added various social media sharing services like Facebook, Twitter, Google+, Digg, among others in the "Enabled Settings" section. However, the sha ...

Styling text within a bootstrap button using CSS

I am currently using Bootstrap and have an accordion with collapsible buttons. Each button consists of two columns of text and an icon on the right. My issue is that I'm attempting to break the text in the second column into multiple lines so that it ...

The gap separating the three columns in the DIVs structure

Here is an example that I need The images are being loaded from a MySQL while loop, and I want the spacing between them to be such that the left column and right column touch each side with the middle image centered. Just like in the picture :D This is m ...

Is it possible for an onclick attribute to assign a function to document.getElementById without overwriting the existing value?

I want to create a numeric keypad in HTML with numbers 1-9, and I'm unsure if JavaScript can handle an onclick function for each key to show the number in the display div. What would be the most effective way to achieve this? <div id="display"> ...