csandreas1
csandreas1

Reputation: 2388

Prevent sentence from breaking line after p tag

Here is the code, is there a way to prevent "sending" word from breaking line ? I cannot change the p tag to span because the animation won't work.

.loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid blue;
  border-right: 16px solid green;
  border-bottom: 16px solid red;
  width: 60px;
  height: 60px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 2s linear infinite;
}
@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
<p class="loader"></p> <span style="white-space:nowrap;"> Sending . . . </span>

Upvotes: 1

Views: 99

Answers (3)

Hardik Kothiya
Hardik Kothiya

Reputation: 27

i think u wont to doing like this


here css code

span {
  left: 29px;
  position: absolute;
  top: 50px;
}

Upvotes: 0

kukkuz
kukkuz

Reputation: 42352

One option is to create a wrapper for the p and the span and make it a flexbox - see demo below:

.wrapper {
  display: flex;
  align-items:center;
}
.loader {
  border: 16px solid #f3f3f3;
  border-radius: 50%;
  border-top: 16px solid blue;
  border-right: 16px solid green;
  border-bottom: 16px solid red;
  width: 60px;
  height: 60px;
  -webkit-animation: spin 2s linear infinite;
  animation: spin 2s linear infinite;
}
@-webkit-keyframes spin {
  0% {
    -webkit-transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
  }
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
<div class="wrapper">
  <p class="loader"></p> <span> Sending . . . </span>
</div>

Upvotes: 2

Taniya
Taniya

Reputation: 550

Try this:

.loader{
  float: left;
}

Upvotes: 0

Related Questions