Search code examples
htmlmarquee

Marquee on the same line with image


I want to put a marquee on "Diversitati transparent" from right to left on the same line with image(like the text from marquee should go into image).

I have this code:

h1 {
  text-shadow: 2px 2px #FF0000;
}

h2 {
  text-shadow: 2px 2px #FF0000;
}

.header img {
  float: left;
  width: 100px;
  height: 100px;
  background: #555;
}

.header h1 {
  position: relative;
  top: 18px;
  left: 140px;
}

.header h2 {
  position: relative;
  top: 18px;
  left: 500px;
}
<div class="header">
  <img src="sigla.jpg" alt="logo" />
  <body bgcolor="lightblue">
    <center>
      <h1>Diversitati transparente</h1>
    </center>
    <i><h2> Pagina de start </h2>
</div>


Solution

    1. Marquee is deprecated
    2. Marquees take up 100% with so make narrower
    3. I fixed some of your html

    body {
      background-color: lightblue
    }
    
    h1 {
      text-shadow: 2px 2px #FF0000;
    }
    
    h2 {
      text-shadow: 2px 2px #FF0000;
    }
    
    .header img {
      float: left;
      width: 100px;
      height: 100px;
      background: #555;
    }
    
    .header h1 {
      position: relative;
      top: 18px;
      left: 140px;
    }
    
    .header h2 {
      position: relative;
      top: 18px;
      left: 500px;
    }
    #imgcontainer { float:left }
    marquee { width:80% } 
    <div class="header">
      <div id="imgcontainer"><img src="https://via.placeholder.com/350x150" alt="logo" /></div>
      <marquee>
        <h1>Diversitati transparente</h1>
      </marquee>
      <h2> Pagina de start </h2>
    </div>