How to set width for table columns in CSS

Tables in html behaves differently than other elements on a page since the table, rows, th and td elements are displayed in a special way. The column width is automatically adjusted based on the content.

Here is a trick to set the column width using the colgroup element which affects both the th and td at once.

A table with 3 columns and 2 rows:

<table>
  <colgroup>
    <col class="col-select" />
    <col class="col-product" />
    <col class="col-country" />
  </colgroup>
  <thead>
    <tr>
      <th>Select</th>
      <th>Product</th>
      <th>Country</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><input type="checkbox">Select</td>
      <td>Product 1</td>
      <td>Sweden</td>
    </tr>
    <tr>
      <td><input type="checkbox">Select</td>
      <td>Product 2</td>
      <td>Norway</td>
    </tr>
  </tbody>
</table>

We have 3 columns: Select, Product and Country
To set the widths we use css classes col-select and so on.

.col-select { 
  width: 1%; 
} 
.col-product { 
  width: 75%; 
} 
.col-country {
  width: 24%; 
}

Here we set the select to be as “narrow” as possible (1%). And the others to relative % numbers.
To further “force” the widths we should allow long words to be wrapped, e.g add the following css class for the columns you wish this behavior for:

.text-break {
  overflow-wrap: break-word;
}

Usage:

<colgroup> 
  <col class="col-select" /> 
  <col class="col-product text-break" /> 
  <col class="col-country text-break" /> 
</colgroup>

Master Angular 17 (a study guide)

Changes and new features

In this article, I list out the most important changes and new features, also share resources that will teach you how these new Angular features work:

  • New, declarative control flow
  • Deferred loading blocks
  • View Transitions API support
  • Support for passing in @Component.stylesas a string
  • Angular’s animations code is lazy-loadable
  • TypeScript 5.2 support

Additional important changes:

  • The core Signal API is now stable (PR)
  • Signal-based components are not ready yet, they won’t be a part of Angular 17 
  • Node.js v16 support has been removed and the minimum support version is v18.13.0 (PR)
  • We expect that Esbuild will be the default builder and the default dev server will use Vite

www.angularaddicts.com/p/master-angular-17

Apache Solr Search Engine: What you need to know

> Have you ever been in a situation where you have an enterprise app with data that exists in an SQL Database, and the business team asked you for a text search feature? > > If you answered yes, most probably your first trial was to conduct a text-based search using the database query. However, it might work, but the database’s ability to provide relevancy is either non-existent or a bolted-on afterthought, and the relevancy ranking of results coming out of a database won’t be satisfactory. > > Additionally, if we added the performance to the equation when you have large volumes of text data, RDBMS will be quite slow and provide poor user experience. > > andela.com/blog-posts/apache-solr-search-engine-what-you-need-to-know >

Apache Solr Search Engine: What you need to know

Have you ever been in a situation where you have an enterprise app with data that exists in an SQL Database, and the business team asked you for a text search feature?
If you answered yes, most probably your first trial was to conduct a text-based search using the database query. However, it might work, but the database’s ability to provide relevancy is either non-existent or a bolted-on afterthought, and the relevancy ranking of results coming out of a database won’t be satisfactory.
Additionally, if we added the performance to the equation when you have large volumes of text data, RDBMS will be quite slow and provide poor user experience.
andela.com/blog-posts/apache-solr-search-engine-what-you-need-to-know