Categories
CSS

How to include one CSS file in another?

Sometimes, we want to include one CSS file in another.

In this article, we’ll look at how to include one CSS file in another.

How to include one CSS file in another?

To include one CSS file in another, we use @import.

For instance, we write

@import url("mystyle.css");

to import mystyle.css in a CSS file to add the styles from the file.

Conclusion

To include one CSS file in another, we use @import.

Categories
CSS

How to add space between two rows in a table with CSS?

Sometimes, we want to add space between two rows in a table with CSS.

In this article, we’ll look at how to add space between two rows in a table with CSS.

How to add space between two rows in a table with CSS?

To add space between two rows in a table with CSS, we set the padding.

For instance, we write

<table>
  <tbody>
    <tr>
      <td>A</td>
      <td>B</td>
    </tr>
    <tr class="spaceUnder">
      <td>C</td>
      <td>D</td>
    </tr>
    <tr>
      <td>E</td>
      <td>F</td>
    </tr>
  </tbody>
</table>

to add a table.

‘Then we write

tr.spaceUnder > td {
  padding-bottom: 1em;
}

to add some bottom padding to the tr with class spaceUnder.

Conclusion

To add space between two rows in a table with CSS, we set the padding.

Categories
CSS

How to write a CSS selector selecting elements not having a certain class or attribute?

Sometimes, we want to write a CSS selector selecting elements not having a certain class or attribute.

In this article, we’ll look at how to write a CSS selector selecting elements not having a certain class or attribute.

How to write a CSS selector selecting elements not having a certain class or attribute?

To write a CSS selector selecting elements not having a certain class or attribute, we use the :not pseudoclass.

For instance, we wrirew

:not(.printable) {
  /* Styles */
}

:not([attribute]) {
  /* Styles */
}

to select the elements that don’t have the printable class with

:not(.printable) {
  /* Styles */
}

And we select the elements that don’t hjave the attribute attribute with

:not([attribute]) {
  /* Styles */
}

Conclusion

To write a CSS selector selecting elements not having a certain class or attribute, we use the :not pseudoclass.

Categories
CSS

How to hide the scroll bar on an HTML page with CSS?

Sometimes, we want to hide the scroll bar on an HTML page with CSS.

In this article, we’ll look at how to hide the scroll bar on an HTML page with CSS.

How to hide the scroll bar on an HTML page with CSS?

To hide the scroll bar on an HTML page with CSS, we select the scrollbar and hide it.

For instance, we write

#element::-webkit-scrollbar {
  display: none;
}

to select the scrollbar for the element with ID element with #element::-webkit-scrollbar.

Then we hide it with display: none;.

Conclusion

To hide the scroll bar on an HTML page with CSS, we select the scrollbar and hide it.

Categories
CSS

How to pass multiple arguments to the :not() pseudo-class?

Sometimes, we want to pass multiple arguments to the :not() pseudo-class.

In this article, we’ll look at how to pass multiple arguments to the :not() pseudo-class.

How to pass multiple arguments to the :not() pseudo-class?

To pass multiple arguments to the :not() pseudo-class, we use multiple :not selectors.

For instance, we write

input:not([type="radio"]):not([type="checkbox"]) {
  //...
}

to select the input that don’t have the type attribute set to radio and don’t it set to checkbox.

Conclusion

To pass multiple arguments to the :not() pseudo-class, we use multiple :not selectors.