简体   繁体   English

将背景图像添加到循环中

[英]Adding image in background into loop

I'm trying to insert image in the background of horizontal letter list (I mean each letter will get small image in the background), it's wordpress code. 我正在尝试在水平字母列表的背景中插入图像(我的意思是每个字母都会在背景中得到小图像),这是wordpress代码。 the code: 编码:

   <?php
    foreach ($letters as $letter) { 
$url = add_query_arg('first_letter',$letter,$pageURL);
    echo "<a href='$url' title='Starting letter $letter' >[ $letter ]&nbsp;&nbsp;</a>";
} ?>

when I try to add: 当我尝试添加时:

  <img src="graybluetab.png" alt="" />  

it's doen't stay horizontal and not in the background - it's display each letter in different line. 它不会保持水平,也不在背景中-它会以不同的行显示每个字母。 What can I do about, I tried to look for a relevat CSS code and I didn't find, Please help. 我该怎么办,我试图寻找相关的CSS代码,但没有找到,请帮忙。 Thanks!!! 谢谢!!!

Actually , you can do it by applying the image as a background image like: 实际上,您可以通过将图像应用为背景图像来做到这一点,例如:

background:url(someimage.jpg);

After that you can repeat that image as you want. 之后,您可以根据需要重复该图像。

background-repeat:repeat-x;

OR 要么

background-repeat:repeat-y;

If you can simulate you code in Fiddle, we can help some more..... 如果您可以在Fiddle中模拟代码,我们可以提供更多帮助.....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM