简体   繁体   English

我怎样才能得到这个边界环绕我的股利?

[英]How can i get this border to wrap around my div?

Hi guys i would like the border to surround my whole <div id=wedding> but it wont wrap around the image and the text within the <div> . 嗨,大家好,我希望边框包围我的整个<div id=wedding>但是它不会环绕<div>的图像和文本。 Please help my code is below: 请帮助我的代码如下:

HTML: HTML:

<div id="Weddings">
        <img src="images/gallery/weddinggh.jpg">
        <br>
        <a href="gweddings">Click here to check out pictures of 
        <br> our past wedding cakes<a>
</div>

CSS: CSS:

#Weddings {
    padding: 2px;
    border: 1px solid;
}

#Weddings a:link {
    text-decoration:none;
    color:black;
    font-size:16px;
    font-family: "footer";
}

#Weddings img {
    width:200px;
    height:300px;
}
#Weddings {
padding: 2px;
border: 1px solid;
width:200px;
}

you just need to set a width to your div :) 您只需要为div设置宽度即可:)

Here's an example : http://jsfiddle.net/f4t2Z/ 这是一个示例: http : //jsfiddle.net/f4t2Z/

Have you tried 你有没有尝试过

#Weddings img {
    width:200px;
    height:300px;
    display:block;
}

You need to define a border color 您需要定义边框颜色

#Weddings {
padding: 2px;
border: 1px solid red;
}

or whatever. 管他呢。

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

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