css - 造型图和图标题

标签 css image styling

我想知道是否以及如何使用我已有的当前 html/css 在 css/html 中实现以下外观:

我想要第一个(红色):/image/tcnVx.jpg

-我有第二个(蓝色)/第三个(绿色)工作 -我希望img(紫色F)跨越该部分的整个宽度,也有一定的高度(部分高度的80%)。让图像像图像中一样填充这个空间

-我希望该图片可点击(打开灯箱)

-figcaption 有文本,应该是部分高度的 20%(这总计为 100%)并且居中(可能是我可以管理的行高,哈哈..)

到目前为止我的代码:

<section>
<article class="graphic">
    <figure>
        <img src="img/Graphic/final.png" alt="Image for graphic work">
        <figcaption>Final logo</figcaption>
    </figure>
</article>

<article class="web">
    <figure>
        <img src="img/Web/obbycmsmockup.png" alt="Image for web work">
        <figcaption>CMS webdesign for OBBYCMS</figcaption>
    </figure>
</article>  

<article class="misc">
    <figure>
        <img src="img/Misc/ww4.jpg" alt="Image for other work">
        <figcaption>Graphic work for WhiteWizard</figcaption>
    </figure>
</article>

最佳答案

我认为这就是您想要实现的目标。设置图形、图像和图形标题的样式。

*{
    box-sizing:border-box;
}
article {
    width:200px;
    height:200px;
    float:left;
    margin:10px;
    color:#FFF;
}
.web {
    background:green
}
.misc {
    background:blue
}
.graphic figure{
    width:100%;
    height:100%;
    margin:0;
    background:#FFF;
}
.graphic figcaption{
    background:#F00;
    color:#FFF;
    width:100%;
    height:20%;
    text-align:center;
    padding:5px;
}
.graphic img {
    width:100%;
    height:80%;
}
.web img, .misc img {
    background:#FFF;
    width:100%;
    height:40%;
}
<article class="graphic">
    <figure>
        <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Intel-logo.svg/2000px-Intel-logo.svg.png" alt="Image for graphic work">
        <figcaption>Final logo</figcaption>
    </figure>
</article>
<article class="web">
    <figure>
        <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Intel-logo.svg/2000px-Intel-logo.svg.png" alt="Image for web work">
        <figcaption>CMS webdesign for OBBYCMS</figcaption>
    </figure>
</article>
<article class="misc">
    <figure>
        <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Intel-logo.svg/2000px-Intel-logo.svg.png" alt="Image for other work">
        <figcaption>Graphic work for WhiteWizard</figcaption>
    </figure>
</article>

如果您还需要其他内容,请评论。如果有帮助,+1。

关于css - 造型图和图标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30834065/

相关文章:

javascript - 根据具有自定义值属性的选择选项显示图像

python - 在 django 文件字段中保存 base64 图像

python - 图像中颜色的分类器

javascript - 加载本地 GeoJSON 文件并将其与 Google Maps Javascript API v3 数据层一起使用

html - 有谁知道如何在 <select> 的选项标签中添加上标

html - 如何关闭 iphone chrome 模拟器中的蓝色覆盖?

javascript - JQuery找到距离当前时间最近的元素值然后添加类

css - css 中的目标边框样式

html - css 在小窗口宽度下更改表中元素的顺序

css - 如何强制一个div到下一行