Search code examples
htmlcssmarquee

HTML Marquee - Static text


I am wondering if a HTML marquee allows static text at the start of the control (or container) so when the text slides to the left it will slide pass the text?

For example.

I am looking at the the date to be static aligned to the left and the text from the database will slide pass it and then reappear from the right.

HTML:

 <marquee onmouseover="this.stop();" onmouseout="this.start();" 
    class="html-scroller" direction="left" behavior="scroll" scrollamount="12">
   <p style="color:#626060; font-weight:bold">24/05/2015 - Some Infor here</p>

CSS:

.html-scroller 
{
    height:30px;
    border:solid;
}

Of course, the code above will make the text including the date slide pass the edge on the controller.

Looking at marquee examples there isn't anything, so if I have to change it, would be be easier to create my own?


Solution

  • I dont think there is a partial static text solution for marquees. I'd do this:

    HTML

    <div class="container">
      <div class="date">24/05/2015</div>
      <div>
        <marquee
          onmouseover="this.stop();"
          onmouseout="this.start();"
          direction="left"
          behavior="scroll"
          scrollamount="12">
          <p>
            Some Infor here
          </p>
        </marquee>
      </div>
    </div>
    

    CSS

    .container
    {
        position: relative;
        border: 2px solid #626060;
        box-sizing: border-box;
    }
    
    .container,
    .container .date {
        padding: 10px;
        background-color: #fff;
        color: #626060;
        font-weight: bold;
    }
    
    .container .date {
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
    }
    
    .container marquee {
        line-height: 0.8;
    }
    
    .container marquee p {
        margin: 0;
    }
    

    http://jsfiddle.net/1wzxywtn/