How to remove the border from IFrame with CSS?

Sometimes, we want to remove the border from IFrame with CSS.

In this article, we’ll look at how to remove the border from IFrame with CSS.

How to remove the border from IFrame with CSS?

To remove the border from IFrame with CSS, we set the frameBorder attribute.

For instance, we write

<iframe src="myURL" width="300" height="300" frameBorder="0">
  Browser not compatible.
</iframe>

to set the frameBorder attribute to 0 to hide the border.

Conclusion

To remove the border from IFrame with CSS, we set the frameBorder attribute.

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.

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.

How to limit text length to n lines using CSS

Sometimes, we want to limit text length to n lines using CSS.

In this article, we’ll look at how to limit text length to n lines using CSS.

How to limit text length to n lines using CSS

To limit text length to n lines using CSS, we use the line-clamp property.

For instance, we write

<div class="text">
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam consectetur
  venenatis blandit. Praesent vehicula, libero non pretium vulputate, lacus arcu
  facilisis lectus, sed feugiat tellus nulla eu dolor. Nulla porta bibendum
  lectus quis euismod. Aliquam volutpat ultricies porttitor. Cras risus nisi,
  accumsan vel cursus ut, sollicitudin vitae dolor. Fusce scelerisque eleifend
  lectus in bibendum. Suspendisse lacinia egestas felis a volutpat.
</div>

to add a div.

Then we write

.text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}

to set the line-clamp property to 2 to show max 2 lines.

We hide overflow with overflow: hidden;

And we add text-overflow: ellipsis; to add ellipsis after the truncated text.

Conclusion

To limit text length to n lines using CSS, we use the line-clamp property.

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.

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.

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.

How to inherit CSS classes?

Sometimes, we want to inherit CSS classes.

In this article, we’ll look at how to inherit CSS classes.

How to inherit CSS classes?

To inherit CSS classes, we add multiple classes to an element.

For instance, we write

<div class="classOne classTwo">
  <p>I'm bold and verdana.</p>
</div>

to add classOne and classTwo to the div.

Then we write

.classOne {
  font-weight: bold;
}
.classTwo {
  font-famiy: verdana;
}

to add the styles for classOne and classTwo.

The styles for both classes will be applied to the div.

Conclusion

To inherit CSS classes, we add multiple classes to an element.

How to check if an element contains a class in JavaScript?

Sometimes, we want to check if an element contains a class in JavaScript.

In this article, we’ll look at how to check if an element contains a class in JavaScript.

How to check if an element contains a class in JavaScript?

To check if an element contains a class in JavaScript, we use classList.

For instance, we write

const hasClassName = element.classList.contains(className);

to check if the className class exists in the element with classList.contains.

Conclusion

To check if an element contains a class in JavaScript, we use classList.

How to set 100% height with padding/margin with CSS?

Sometimes, we want to set 100% height with padding/margin with CSS.

In this articl, we’ll look at how to set 100% height with padding/margin with CSS.

How to set 100% height with padding/margin with CSS?

To set 100% height with padding/margin with CSS, we set the box-sizing property.

For instance, we write

div {
  box-sizing: border-box;
}

to make the div stay the same size after adding padding.

Conclusion

To set 100% height with padding/margin with CSS, we set the box-sizing property.