2

When highlighting text to copy, the blue selection goes across the entire page when selecting each line (as you can see in the image below)

enter image description here

How do you make it so it doesn't go across the page, like in the image below?

enter image description here

My code:

HTML:

<div class="maintext">

Welcome/logo

    <div class="headtab">
    About
    </div>

    <p class="info">

   SOME CONTENT

    </p>

  <div class="headtab">
  Requests
  </div>
  <p class="info">
  More content
  </p>

</div>

Then the CSS:

.maintext {
    background-color: #FFF;
    width: 950px;
    align: center;
    padding-top: 50px;
    margin-top: 0;
    margin-right: auto;
    margin-bottom: 0;
    margin-left: auto;
    padding-right: 70px;
    padding-left: 70px;
    padding-bottom: 100px;
    display: block;
}
p.info {
    font-family: 'Josefin Slab', serif;
    font-size: 22px;
    color: #000;
    font-weight: 200;
    line-height: 150%;
    word-wrap:break-word;
    display: block;
}
.headtab {
    margin-left: -110px;
    z-index: 20;
    background-color: #FF8100;
    height: 30px;
    width: 120px;
    line-heihgt: 20px;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
    font-size: 24px;
    color: #FFF;
    text-decoration: underline; 
    /* The following stopping of text selection is from: http://stackoverflow.com/questions/7018324/how-do-i-stop-highlighting-of-a-div-element-when-double-clicking-on */
-webkit-user-select: none; /* Chrome/Safari */        
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+ */

/* Rules below not implemented in browsers yet */
-o-user-select: none;
user-select: none;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 30px;
}
Nat Ritmeyer
  • 5,634
  • 8
  • 45
  • 58
MyNameWouldGoHere
  • 145
  • 1
  • 2
  • 13

1 Answers1

1

You must use some sort of block tag such as <div> to put the text into. THe highlight will only be as big as the div the texts sits in.

urnotsam
  • 770
  • 7
  • 24