对不起,如果之前已经回答过,但我无法在任何地方找到它。
我正在尝试创建一种缩略图库但我无法在html代码中设置元素的宽度和高度。 出于某种原因,如果我在样式表中设置大小,但在代码本身中没有设置大小。 我一直试图弄清楚这一点,这让我疯了。 我希望这很简单,我误解了。 任何帮助将不胜感激。 这是一个示例链接:
http://jsfiddle.net/4gupR/1/
CSS
.box { display: block; float: left; margin: 0 20px 20px 0; } figure { position: relative; margin: 0; padding: 0; display: block; }HTML
<div class="box"> <figure width="800" height="800"> <img src="http://placehold.it/400x300"> </figure> <figcaption>Caption</figcaption> </div>只是为了澄清,重要的是我通过HTML代码执行此操作,而且,我需要设置大小,而不仅仅是使用边距或填充...
一如既往,非常感谢您提供的任何帮助!
sorry if this has been answered before, but I haven't been able to find it anywhere.
I am trying to create a sort of thumbnail gallery but I am having trouble setting the width and heights of elements in the html code. For some reason it works if I set the size in the stylesheet, but not in the code itself. I have been trying to figure this out all night and it's driving me nuts. I'm hoping it's something simple that I am misunderstanding. Any help would be greatly appreciated. Here's a link to a sample:
http://jsfiddle.net/4gupR/1/
CSS
.box { display: block; float: left; margin: 0 20px 20px 0; } figure { position: relative; margin: 0; padding: 0; display: block; }HTML
<div class="box"> <figure width="800" height="800"> <img src="http://placehold.it/400x300"> </figure> <figcaption>Caption</figcaption> </div>Just to clarify, it is important that I do this through the html code, and also, I need to set the size, and not just use margin, or padding…
As always, thanks so much for any help you can offer!
最满意答案
如果要使用内联样式,则必须使用“样式”属性。
<div style="property: value;">http://jsfiddle.net/bZkYS/1/
When you want to use inline styles, you have to use the "style" attribute.
<div style="property: value;">http://jsfiddle.net/bZkYS/1/
更多推荐
发布评论