如何将图像图标放在句子中以使其像角色一样流动?

时间:2015-12-01 19:59:29

标签: html css

我有句子“点击'了解更多'按钮以获取更多信息”我试图在“了解更多”之前放置一个(i)信息图标,但我似乎无法做到正确。它出现在了解更多内容之上。

有人可以帮忙吗?

编辑:对不起,这是我的代码:

在整个练习中点击“了解更多”按钮,以获取特定于每项服务的其他信息。

在“了解更多”之前有我的形象:

function changeImage(down) {

  positionID = parseInt(document.getElementById("IdNum").getAttribute("name"));
      if(down){
        positionID--;
      } else {
        positionID++;
      }
      if(positionID < 0){
        positionID = positionID + 28;
      }
      positionID = positionID % 28;   

  document.getElementById("IdNum").setAttribute("name", positionID);
  document.getElementById("IdNum").innerHTML =
    "<input type= 'checkbox' name='ID' value='" + positionID + "'checked> " +
    positionID;

  positionSpot = parseInt(document.getElementById("Poscounter").getAttribute("name"));
      if(down){
        positionSpot--;
      } else {
        positionSpot++;
      }
      if(positionSpot < 0){
         positionSpot =  positionSpot + 28;
      }
  positionSpot = positionSpot % 7;

  document.getElementById("Poscounter").setAttribute("name", positionSpot);
  document.getElementById("Poscounter").innerHTML =
    "<input type= 'checkbox' name='Position' value='" + positionSpot +
    "'checked> " + positionSpot;

  GroupSpot = parseInt(document.getElementById("Groupcounter").getAttribute("name"));
      // not necessary, because we do it directly
  // GroupSpot = GroupSpot % 4;

      GroupSpot = Math.floor(positionID / 7);

      document.getElementById("Groupcounter").innerHTML =
    "<input type= 'checkbox' name='Position' value='" +  GroupSpot +
    "'checked> " +  GroupSpot;
}

然后在CSS中使用:

<img id="learn" src="http://public.citizenbudget.com.s3.amazonaws.com/uploads/custom/london/Screen%20Shot%202015-12-01%20at%202.41.23%20PM.png" width="20"> 

3 个答案:

答案 0 :(得分:1)

display: inline元素上尝试使用img,例如:

<p>
Some text with an image here <img style='display:inline;' src='blah.jpg'/>
</p>

答案 1 :(得分:0)

尝试&#34;显示:内联;&#34; 这应该显示带有文本流的图像,但向我们展示您的代码我确信我们能够让它工作

编辑:您不需要位置:绝对,除非您想将该图标移动到任何您想要的位置,因此只需使用&#34; display:inline&#34; 同时在p标签内插入图像标签

答案 2 :(得分:0)

<p>Learn More<img style="display: inline;" src="http://public.citizenbudget.com.s3.amazonaws.com/uploads/custom/london/Screen%20Shot%202015-12-01%20at%202.41.23%20PM.png" width="23px" height="23px"> </p>