放置&使用 CSS 定位图像?
完全编辑了这个问题,不确定以前是否有意义。
好的,我在网站上定位某些图像时遇到困难。我正在使用 Slidedeck jQuery 幻灯片,在第三张幻灯片中我想要一个作品集,因此只需显示 6 张图像(2 行,每行 3 张)。
在index.html中,幻灯片设置如下;
<div id="slidedeck_frame" class="skin-voyager">
<dl class="slidedeck">
<dt>ABOUT US</dt>
<dd>About the company here</dd>
<dt>OUR SERVICES</dt>
<dd>Company services here</dd>
<dt>PORTFOLIO</dt>
<dd>Images of completed work here</dd>
<dt>Contact Us</dt>
<dd>Contact form here</dd>
</dl>
</div>
每张幻灯片都在 CSS 表中使用以下标签进行格式化;
.slidedeck dd.slide_1
在第三张幻灯片中,我需要能够使用 CSS 来简单地显示图像行来定位它们。我尝试了很多事情,但都做不好。在index.html中我尝试过;
<dt>PORTFOLIO</dt>
<dd><img src="images/myImage1.png" width="130" height="130" />
</dd>
但这显然只是显示图像,无法对其进行格式化。
我也尝试过;
<dt>PORTFOLIO</dt>
<dd>
<div>
<img id="image1" src="images/myImage1.png" width="130" height="130">
</div>
</dd>
然后使用下面的CSS来定位;
img#image1 {
position: relative;
top: 20px;
left: 10px;
z-index: 5;
但图像
根本不显示。
有什么建议吗?
Edited this question entirely, not sure if it made sense previously.
Ok, I am having difficulty positioning some images on a website. I am using the slidedeck jQuery slideshow, and in the third slide I want a portfolio of work, so just to display 6 images (2 rows of 3).
In the index.html the slides are set up as follows;
<div id="slidedeck_frame" class="skin-voyager">
<dl class="slidedeck">
<dt>ABOUT US</dt>
<dd>About the company here</dd>
<dt>OUR SERVICES</dt>
<dd>Company services here</dd>
<dt>PORTFOLIO</dt>
<dd>Images of completed work here</dd>
<dt>Contact Us</dt>
<dd>Contact form here</dd>
</dl>
</div>
Each of these slides is formatted in the CSS sheet with the following tag;
.slidedeck dd.slide_1
In the third slide, I need to be able to simply show rows of images using the CSS to position them. I have tried a number of things but can't get it right. In the index.html I have tried;
<dt>PORTFOLIO</dt>
<dd><img src="images/myImage1.png" width="130" height="130" />
</dd>
But that obviously just display an image, with no ability to format it.
I have also tried;
<dt>PORTFOLIO</dt>
<dd>
<div>
<img id="image1" src="images/myImage1.png" width="130" height="130">
</div>
</dd>
and then using the following CSS to position;
img#image1 {
position: relative;
top: 20px;
left: 10px;
z-index: 5;
}
But the image just doesn't show up at all.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用
dd.slide_1
进行样式设置,但没有一个元素应用了该类。
编辑
给定这个html:
您应该能够像这样设置图像的样式
如果这不起作用,请尝试在样式值后添加
!important
。如果这有效,请调查哪些 CSS(可能来自 jQuery 插件)正在干扰您的样式。如果可以的话,尽量不要留下!important
。因此,对于 2 行 3 张图像,您需要这个 css
You are styling with
dd.slide_1
but none of the<dd>
elements have that class applied.Edit
Given this html:
You should be able to style your images like this
If that isn't working try adding
!important
after your style values. If this works investigate what CSS (perhaps from jQuery plugins) is interfering with your styles. Try not to leave!important
in if you can help it.So for 2 rows of 3 images you would need this css