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>

Introduction to Angular Storybook – a tool for component UI development

Introduction to Storybook for Angular Storybook is a tool for UI development. It makes development faster and easier by isolating components. This allows you to work on one component at a time. You can develop entire UIs without needing to start up a complex dev stack, force certain data into your database, or navigate around your application.

Source: Introduction to Storybook

Pinegrow Web Editor | Website Builder for Professionals

Pinegrow Web Editor, website builder for professionalsPinegrow is a Mac, Windows and Linux web editor that lets you build modern websites faster with live multi-page editing, CSS & SASS styling, CSS Grid editor and support for Bootstrap, Tailwind CSS and WordPress.Pinegrow is a desktop website editor that opens and saves standard HTML and CSS files.

Source: Pinegrow Web Editor | Website Builder for Professionals

CSS Peeper – Chrome Css Extension

Extract CSS and build beautiful styleguides. 🔎 No more digging in a code. Inspect styles in a simple, well-organized & beautiful way. Get it now! CSS Peeper is a CSS viewer tailored for Designers. Get access to the useful styles with our Chrome extension. Our mission is to let Designers focus on design, and spend as little time as possible digging in a code. Ever wondered what’s the line-height, font or a button size on a website? We provide you the ultimate tool to satisfy your curiosity. We enable you to inspect code in the easiest possible way. Check the hidden CSS style of objects, colors and assets on the web.

Source: CSS Peeper – Chrome Web Store

Error Handling with Angular 8 – Tips and Best Practices

Handling errors properly is essential in building a robust application in Angular. Error handlers provide an opportunity to present friendly information to the user and collect important data for development. In today’s age of advanced front-end websites, it’s more important than ever to have an effective client-side solution for error handling.

An application that does not handle errors gracefully leaves its users confused and frustrated when the app suddenly breaks without explanation. Handling these errors correctly across an application greatly improves user experience. Collected data from the error handling can inform the development team about important issues that slipped past testing. This is why monitoring tools like Rollbar are so important.

In this article, we will compare several solutions for error handling in Angular apps. First, we will describe the traditional approaches using ErrorHandler and HttpClient. Then, we will show you a better solution using HttpInterceptor. We’ll also show you how to use this interceptor to monitor and track errors centrally in Rollbar.

 

Source: Error Handling with Angular 8 – Tips and Best Practices