html - 如何使用 CSS HTML 将圆向下移动 15px

标签 html css

我想用 CSS 将圆圈向下移动 15px,如下图所示。我尝试在 .circle 类中使用 padding-bottommargin-bottom ,但它确实以另一种方式工作,即制作圆圈比自己长。

enter image description here

HTML:

<table id="showRoom">
    <tr class="box_shadow">
        <td>
            <div class="news_column1"> 
                <a target="_blank" href="http://google.com">
                    <span class="circle">P1</span>
                    <span class="imgswap">Showroom 1</span>
                    <div class="news_img">
                        <div>
                            <p>Book Now!</p>
                        </div>
                    </div>
                </a>
            </div>
        </td>
    </tr>
</table>

CSS:

body {
    background-color: #F6F6F6;
}

#showRoom {
    margin-left: 10px;
    margin-top: 20px;
    width: auto;
    border-collapse: collapse;
}

table td {
    padding: 0;
}

table .box_shadow {
    background-color: #FFF;
    font-size: 18px;
    line-height: 20px;
    text-align: center;
    font-weight: normal;
    font-family: 'Scada', sans-serif;
    display: block;
    -webkit-box-shadow: -4px 4px 5px 0px rgba(50, 50, 50, 0.3);
    -moz-box-shadow: -4px 4px 5px 0px rgba(50, 50, 50, 0.3);
    box-shadow: -4px 4px 5px 0px rgba(50, 50, 50, 0.3);
}

table tr .text_plant_address {
    background-color: #FFF;
    width: 200px;
    height: 200px;
    line-height: 20px;
    text-align: center;
    font-weight: normal;
    font-family: 'Scada', sans-serif;
    margin: 0;
    padding: 0;
}

table tr td span {
    height: 195px;
    width: auto;
}

table tr td div {
    width: 200px;
    height: 200px;
    position: relative;
}

table tr td a {
    text-decoration: none;
}

table tr td .text_plant {
    border-bottom: 1px solid #D0D0D0;
    font-family: ballpark_weiner, Arial;
    font-size: 26px;
    letter-spacing: 1px;
    padding: 0 15px;
}

table tr td .text_address {
    font-size: 10px;
    font-family: Arial;
    display: block;
    position: relative;
    height: auto;
    margin-top: 5px;
}

.news_column1 {
    background-color: #FF7F7F;
    /*background-color: #FFF;*/
    /*border-radius: 15px;*/
}

table tr td div:hover {
    cursor: pointer;
}

.news_img {
    width: 200px;
    height: 70px;
    text-align: center;
    background-color: rgba(0, 0, 0, 0.4);
    font-family: 'Times New Roman';
    font-weight: bold;
    letter-spacing: 0.5px;
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    opacity: 0.95;
    /*border-radius: 0 0 15px 15px;*/
}

.news_img div {
    width: 200px;
    height: 10px;
    margin: 0;
    padding: 0;
    display: table-cell;
    vertical-align: middle;
}

.news_img div p {
    display: block;
    margin-top: 25px;
    font-size: 17px;
    color: #FFF;
    transform: rotate(-10deg);
    -ms-transform: rotate(-10deg);
    /* IE 9 */
    -webkit-transform: rotate(-10deg);
    /* Opera, Chrome, and Safari */
}

span.circle {
    width: 100px;
    height: 100px;
    font-size: 30px;
    color: #fff;
    line-height: 100px;
    text-align: center;
    background-color: #111111;
    opacity: 0.3;
    display: block;
    margin: 0 50px 0 50px;
    -webkit-border-radius: 50px;
    -moz-border-radius: 50px;
    border-radius: 50px;
}

span.imgswap {
    display: block;
    opacity: 0.5;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    font-family: sans-serif;
    font-size: 20px;
    padding-top: 10px;
    font-family: Stark;
    letter-spacing: 0.5px;
}

JSFIDDLE: http://jsfiddle.net/huydq91/rB5hX/7/

最佳答案

只需要添加padding;

table tr td div {
    width: 200px;
    height: 200px;
    position: relative;
    padding-top:15px;
}

UPDATED JS FIDDLE

关于html - 如何使用 CSS HTML 将圆向下移动 15px,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23189948/

相关文章:

css - 如何使 Canvas 响应

css - 我的阴影过滤器语法不正确吗?

javascript - nicedit 所见即所得编辑器 + 字符计数

javascript - 如何在单击 meteor 中动态生成的每个 block 时显示表单?

javascript - 颜色数组,试图给它们一些不透明度

CSS 按钮悬停使文本闪烁

html - 仅使用 CSS 输入文本时更改输入样式

java - 将html解析为树

html - 如何在CSS中换行显示字母

javascript - Javascript 创建的字段上的 jqueryUI datepicker