Categories
CSS

How to select elements with two classes with CSS?

To select elements with two classes with CSS, we add both class selectors.

For instance, we werite

.foo.bar {
  color: red;
}

to add select elements with both the foo and bar class applied and set their content color to red.

Categories
CSS

How to fix CSS text-overflow: ellipsis; not working?

To fix CSS text-overflow: ellipsis; not working, we should apply the text-overflow style to an inline-block element.

For instance, we write

.app a {
  height: 18px;
  width: 140px;
  padding: 0;
  overflow: hidden;
  position: relative;
  display: inline-block;
  margin: 0 5px 0 5px;
  text-align: center;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #000;
}

to make the a elements inline block with display: inline-block;.

Then we can apply the text-overflow: ellipsis; style.

Categories
CSS

How to use CSS media queries to select max-width OR max-height?

To use CSS media queries to select max-width OR max-height, we separate the queries by commas.

For instance, we write

@media screen and (max-width: 995px), screen and (max-height: 700px) {
  //...
}

to select screen sizes with max width 995px or max height 700px.

Categories
CSS

How to import a regular CSS file into a SCSS file?

To import a regular CSS file into a SCSS file, we use @import.

For instance, we write

@import "path/to/file";

to use @import to import the "path/to/file" CSS file into our SCSS file.

Categories
CSS

How to add CSS font border?

To add CSS font border, we add the text-stroke property.

For instance, we write

h1 {
  -webkit-text-stroke: 2px black;
  font-family: sans;
  color: yellow;
}

to set the -webkit-text-stroke property to the border style we want on h1 elements.