2015-06-14 37 views
0

我想知道如果我如何能實現在CSS/HTML以下的外觀與目前的HTML/CSS我已經有:造型圖和figcaption

我想要得到的第一(紅色)之一:http://i.stack.imgur.com/tcnVx.jpg

- 我有第二個(藍色)/第三個(綠色)的工作 - 我想img(紫色的F)跨越整個寬度的部分,也有一定的高度(80%的部分高度)。有圖像

-I希望IMG是可點擊(打開收藏夾)

-The 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> 

+0

不很確定你在問什麼...... – DaemonOfTheWest

+0

你可以加入css co第二個和第三個盒子?我們應該有一個開始。 –

回答

0

我想這就是你什麼灣t來實現。造型的數字,圖像和figcaptions。

*{ 
 
    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。

+1

謝謝!這看起來像它會wokr對我來說真棒:)我^ –

1
  • 對於結構

以上Vann'Tile lanito的代碼是好的。只需要把所有元素父容器

eg: <div class="container"><--all element inside this--></div> 

CSS:

**.container{ 
width: 100%; 
background: grey 
}** 
  • 對於燈箱

爲了讓IMG點擊(打開燈箱)。 你必須使用jQuery來做到這一點。您CA使用插件收藏這樣的: -

Fancybox

lightbox2

如果您正在尋找響應燈箱:

Lightbox/Responsive

Dimsemenov plugins

+1

謝謝你的提示和對不起,我沒有發佈這個CSS,我的壞,我會下一次:) –

+0

嘿再次,我試過fancybox敏感,當我點擊它打開的圖像時,我無疑會得到一個錯誤,但奇怪地調整到它的大小的10倍並且一直向上。你可以在這裏查看:http://eduweb.hhs.nl/~14042568/Help/(我的學校網站,沒有病毒) –

+0

請添加:'hideOnContentClick':true並且爲了重新調整寬度,你可以從「 jquery.fancybox-1.3.4.css「文件。 –