html - 初学者 : Creating Buckets in HTML and CSS

标签 html css web

我试图通过将标题图像放在底部图像的顶部来使用 HTML 和 CSS 创建一个桶。当我在 Dreamweaver 中执行此操作时,两个对象之间没有间隙。但是,当我将它上传到服务器时,两张图片之间出现了差距。有什么帮助或建议吗?

enter image description here

 <div class="wrapBucketInnerLeft">
        <div class="bucketLeft">
            <h2 class="bucketHeader"><img src="images/bucket_header_text_basic.png" width="212" height="36" alt="Basic Plan" /></h2></td></tr>

            <div class="bucketDetails">
            <ul>
                <li>Feature 1</li>
                <li>Feature 2</li>
                <li>Feature 3</li>
                <li>Feature 4</li>
            </ul> 
            <div class="bucketBottom">               
            <p class="cost">$1.95</p>
            <a href="#"><img class="button" src="images/button_bucket.png" width="117" height="42" alt="Learn More" /></a></div>
        </div>
        </div>
         <!--Bucket 2-->

        <div class="bucketRight">
            <h2 class="bucketHeader"><img src="images/bucket_header_text_economy.png" width="212" height="36" alt="Basic Plan" /></h2>
            <div class="bucketDetails">
                <ul>
                    <li>Feature 1</li>
                    <li>Feature 2</li>
                    <li>Feature 3</li>
                    <li>Feature 4</li>
                </ul>                
                <div class="bucketBottom">               
                <p class="cost">$1.95</p>
                <a href="#"><img class="button" src="images/button_bucket.png" width="117" height="42" alt="Learn More" /></a></div>
        </div>
        </div>
        </div>

CSS:

.bucketHeader {
background-image:url(images/bg_header_bucket.png);
background-repeat:no-repeat;
background-position:top center;
height:46px;
margin:0px 0px 0px 0px;
    padding:14px 0px 0px 18px;
}

.bucketDetails {
    background-image:url(images/bg_bucket.png);
    background-repeat:no-repeat;
    background-position:top center;
    height:278px;
    margin:0px 0px 0px 0px;
    padding:0px;
}

.bucketBottom p.cost {
    font-size:28px;
    font-weight:bold;
    color:#335191;
    margin:0px 0px 6px 0px;
    padding:0px;
}
.bucketBottom{
    text-align:center;

}
a img.button {
    border:none;
}

最佳答案

嗯,我知道是什么了! .bucketHeader

的填充
.bucketHeader {
background-image:url(images/bg_header_bucket.png);
background-repeat:no-repeat;
background-position:top center;
height:46px; // here reduce the height of this div until the gap between them is removed, i think it should be 28px
margin:0px 0px 0px 0px;
padding:14px 0px 0px 18px; // here you see you have given padding of 14px of both top and bottom, this increases the height of div magically which you can't see because your image has background-repeat:no-repeat
}

关于html - 初学者 : Creating Buckets in HTML and CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14004155/

相关文章:

jQuery .toggleClass() 转换

javascript - 如何 append 和更改 append 数字的属性(在 css 中)

css - 使用css使对象出现,然后延迟后,使其消失

html - 无需实际编辑源即可自定义背景重复

html - 外部 CSS 在 NodeJS 中不起作用

html - 将最小值设置为减法 (AngularJS)

不带存储的 Python Django Rest Post API

javascript - 无法在 'postMessage' : 2 arguments required, 上执行 'Window' 但只有 1 个存在

html - 垂直居中并将文本环绕在另一个 div 周围

html - Bootstrap 面板问题 - 面板标题不是全宽?