Categories
HTML

How to add a tooltip to a div with HTML?

To add a tooltip to a div with HTML, we set the title attribute.

For instance, we write

<div title="This is my tooltip">tooltip</div>

to add a div.

Then we set its title attribute to the tooltip text.

We see the tooltip when we hover over the div.

Categories
CSS

How to remove blue underline from link with CSS?

To remove blue underline from link with CSS, we set the text-decoration property.

For instance, we write

a {
  color: #ffffff;
  text-decoration: none;
}

to select a elements and remove their blue underline with text-decoration: none;.

Categories
CSS

How to add outline radius to a div with CSS?

To add outline radius to a div with CSS, we add the border and border-radius propeties.

For instance, we write

<div></div>

to add a div.

Then we write

div {
  background: #999;
  height: 100px;
  width: 200px;
  border: #999 solid 1px;
  border-radius: 10px;
  margin: 15px;
  box-shadow: 0px 0px 0px 1px #fff inset;
}

to add the border-radius to make the corners rounded.

And we set the border property to the border styles to show the border with rounded corners.

Categories
CSS

How to stretch and scale CSS background?

To stretch and scale CSS background, we set the background-size property.

For instance, we write

#my_container {
  background-size: 100% auto;
}

to set the background-size property to 100% auto; to stretch and scale the border to fill the element.

Categories
CSS

How to force child div to be 100% of parent div’s height without specifying parent’s height with CSS?

To force child div to be 100% of parent div’s height without specifying parent’s height with CSS, we use flexbox.

For instance, we write

.parent {
  display: flex;
  flex-direction: row;
}

.child {
  align-self: center; 
}

to make the element with class parent a flex container with display: flex;.

And then the children element should fill the parent’s height by default.