HTML, CSS Fullscreen Carousel - css

I am having issues with my code for my CSS carousel. I have Javascript just switching some of the classes so I know that is not an issue. My issue is that the height of the image is not scaling the way I would like it to. I want this site to be responsive and the first step is making this fullscreen carousel working. I am making a one pager so I would like to be able to scroll down past the carousel, but when the page initially loads I would like it to show the fullscreen carousel and the NAV bar. The NAV bar is fine right now but the carousel is having issues with the height scaling. As the browser window gets smaller the image will become smaller than the screen, thus it is not fullscreen anymore. I don't mind if some of the image is cut off but I would like the carousel to always be full screen unless the user scrolls down or clicks on a link to an anchor point.
Here is the CSS:
/* General */
*{
box-sizing:border-box;
}
html {
margin:0;
padding:0;
width:100vw;
/* min-height:100vh;
*/
}
body {
width:100%;
max-width:100%;
min-height:100vh;
margin:0;
padding:60px 0 0 0;
background-color:#333333;
font-family: 'Varela Round', sans-serif;
}
/* ***Menu CSS*** */
/* -------------------------------------------
Nav bar
------------------------------------------- */
nav {
background-color:rgba(22,22,22,0.7);
position:fixed;
top:0;
left:0;
right:0;
height: 60px;
text-align:center;
z-index:2;
}
nav:after {
content:"";
position:absolute;
top:0;
right:0;
width:0;
height:0;
border-style:solid;
border-width:0 60px 60px 0;
border-color:transparent #50C0C0 transparent transparent;
}
nav a {
text-decoration:none;
color:initial;
}
nav .navButton {
display:inline-block;
color:#50C0C0;
line-height:60px;
padding:0 50px;
position: relative;
}
nav .navButton:after {
content:"";
transition:width .5s, left .5s;
-webkit-transition:width .5s, left .5s;
-moz-transition:width .5s, left .5s;
-o-transition:width .5s, left .5s;
width:0;
left:50%;
}
nav .navButton:hover:after {
content:"";
left:20%;
height:1.5px;
width:60%;
background-color:#50C0C0;
position:absolute;
bottom:0;
box-shadow: 0 -3px 15px #ffffff;
}
/* div around all nav buttons */
nav .buttonWrapper {
display:inline-block;
text-align:center;
}
/* ***Carousel css*** */
/* -------------------------------------------
Carousel
------------------------------------------- */
.carousel {
width:100%;
position:relative;
height: 100%;
}
.carousel .imageContainer {
position:absolute;
transition:width .5s;
-webkit-transition:width .5s;
-moz-transition:width .5s;
-o-transition:width .5s;
overflow:hidden;
width:100%;
}
.carousel .imageContainer img {
width: 100vw;
min-width:100%;
min-height:100%;
}
.carousel .imageContainer.closed {
width:0;
}
.carousel .imageContainer.open {
width:100%;
}
.carousel .imageContainer.fromRight {
right:0;
}
.carousel .imageContainer.fromLeft {
left:0;
}

in order to keep your carousel full screen you need to set the width = 100% ( of course ), and have the height at 100vh, this will maintain the height of the carousel 100% height of the viewport. Should do the trick.
#carousel{
position:relavite;
display:block;
width:100%;
margin-top:70px;
height:calc(100vh - 70px);
background:#000 url('http://lorempixel.com/1100/1100/sports/') no-repeat top center;
background-size:cover;
z-index:1;
}
*you may consider to set the images on of your carousel as background images and set the size to cover. On my example, i subtracted the height of the nav, so the carousel can be rest of the height and pushed it down with margin.
you can preview here:
https://plnkr.co/edit/4AsQ3PoM0Ze2gOFENsVG?p=preview

Related

owl slider questioin. Navigation buttons flickers when hover

Can any one tell me why owl slider's navigation buttons flickering when hovered?
These are the '+' plus sign images.
http://kmg.makingconnection.co.uk/
Thankyou 'dingo_d'. By doing left:0 & right:0 along with position: absolute solved my problem.
Your buttons have opacity over them at 0.5, and when you hover there is a change in the opacity to 1
.owl-theme .owl-controls.clickable .owl-buttons div:hover {
filter: Alpha(Opacity=100);
opacity: 1;
text-decoration: none;
}
Because you are using background as a plus sign, every time you are hovering over it you apparently trigger that change that results in a flicker. It's better to use pseudoelements for this (even though when you turn the opacity down you can see a bit of overlap)
#owl-demo .owl-prev{
float: left;
margin-left: 65px;
font-size: 0;
width: 32px;
height: 31px;
position:relative;
background:transparent;
}
#owl-demo .owl-prev:before,
#owl-demo .owl-prev:after{
content:"";
position:absolute;
top:0;
left:50%;
margin-left:-4px;
width:8px;
height:32px;
border-radius:3px;
background: #ED1B34;
opacity:0.5;
}
#owl-demo .owl-prev:after{
transform: rotate(90deg);
}
#owl-demo .owl-prev:hover:before,
#owl-demo .owl-prev:hover:after{
opacity:1;
}

Images stack when animated

Since I've animated my images (a caption appears when hovered), the images stack vertically instead of horizontally when viewed on Chrome. Here is the url - http://goodyearsinc.com/releases
I've tried adding "float: left" to the img wrap which worked on Firefox but not on Chrome. I am pulling my hair out trying to work it out.
Here is the jsfiddle with the css - http://jsfiddle.net/8eTB2/
.item1, .item2, .item3, .item4
{
float:left;
}
.img-wrap{
height:150px;
overflow:hidden;
position:relative;
float: left;
margin-right: 5px;
}
.img-overlay{
background-color:#000;
bottom:0;
color:#fff;
opacity:0;
filter: alpha(opacity = 0);
position:absolute;
width:100%;
z-index:1000;
}
.img-overlay h4, .img-overlay p{
padding:0 10px;
}
.img-wrap:hover .img-overlay{
opacity:0.75;
filter: alpha(opacity = 75);
transition:opacity 0.25s;
-moz-transition:opacity 0.25s;
-webkit-transition:opacity 0.25s;
}
Remove the float: left from the
.item1, .item2, .item3, .item4 {
float: left;
}
Try adjusting the width manually, on Chrome the width is 327px where firefox showed 465px.

CSS Sticky footer with 100% width

I'm trying to implement a sticky footer having a 100% of width. It should be stick on the bottom of the page, but not overlapping the page content div.
I'm using the page layout identical to this example:
http://peterned.home.xs4all.nl/examples/csslayout1.html
As you can see, the footer has the same width of div#container.
But I want to stretch the footer up to 100% width, whilst the page content stays centered and keeps stretching in height when resizing the browser.
How can I do that?
try this
click le link to see new result
http://jsfiddle.net/n6u3e/
/**
* 100% height layout with header and footer
* ----------------------------------------------
* Feel free to copy/use/change/improve
*/
html,body {
margin:0;
padding:0;
height:100%; /* needed for container min-height */
background:gray;
font-family:arial,sans-serif;
font-size:small;
color:#666;
}
h1 {
font:1.5em georgia,serif;
margin:0.5em 0;
}
h2 {
font:1.25em georgia,serif;
margin:0 0 0.5em;
}
h1, h2, a {
color:orange;
}
p {
line-height:1.5;
margin:0 0 1em;
}
div#container {
position:relative; /* needed for footer positioning*/
margin:0 auto; /* center, not in IE5 */
width:750px;
background:#f0f0f0;
height:auto !important; /* real browsers */
height:100%; /* IE6: treaded as min-height*/
min-height:100%; /* real browsers */
}
div#header {
padding:1em;
background:#ddd url("../csslayout.gif") 98% 10px no-repeat;
border-bottom:6px double gray;
}
div#header p {
font-style:italic;
font-size:1.1em;
margin:0;
}
div#content {
padding:1em 1em 5em; /* bottom padding for footer */
}
div#content p {
text-align:justify;
padding:0 1em;
}
div#footer {
background:#ddd;
border-top:6px double gray;
}
div#footer p {
padding:1em;
margin:0;
}
#barco{
width:750px;
margin:auto;
}

Image and description inside DIV

I'm trying to put an image and its description at the bottom of the image (and over the image with the opacity 0.8). Both the elements are inside a div element. But enable display the title.
.title {
opacity:0.8;
background-color:black;
color:white;
height:40px;
width:100%;
position:relative;
bottom:0px;
z-index:2;
clear:both;
}
.tilebg {
position:relative;
top:0px;
height:100%;
z-index:0;
opacity:1;
}
I've made a fiddle with example
Here's how positioning works:
position:relative - this sets the current element as the origin point (0,0)
position:absolute - this sets the position of an element in respect to its origin. If the parent has position:relative, that becomes the origin. Otherwise, it goes up the HTML tree until it finds one, defaulting to BODY if none is defined.
So: parent = relative, child = absolute
.item {
opacity:1;
background-color:grey;
margin:20px;
margin-left:20px;
width:200px;
height:200px;
position:relative;
background-image:url(http://i.imgur.com/vdDQgb.jpg);
}
.title {
opacity:0.8;
background-color:black;
color:white;
height:40px;
width:100%;
position:absolute;
bottom:0px;
z-index:2;
clear:both;
font-size:12px;
}
I would encourage you to use the new figure and figcaption elements since they were created for this very purpose:
<figure>
<img src="http://placekitten.com/300/200" />
<figcaption>This is the caption.</figcaption>
</figure>
​With the following CSS:
figure {
width: 300px; height: 200px;
position: relative; /* Permits placement figcaption absolutely */
}
figcaption {
position: absolute;
bottom: 0; left: 0; width: 100%;
background: rgba(0,0,0,.8); /* Semi-transparent background */
}
Demo: http://jsfiddle.net/qu4a3/1/

Mobile web app, styling in percentages; I can't get height to work

I am building a mobile app for a band and obviously want it to display well in all the plethora of handsets out there today. I built it at first for my own device and it looks and works great, so now I am reworking it in percentages so that it works in all devices.
I have a slider (jquerytools) going on and if i set width to 100% then it is perfectly wide in my iphone and my ipad... success, however I am not having any luck with height. It seems to only accept a height in px. If i set a height in percent it just doesn't display.
any ideas?
Updated CSS:
#header{
width:100%;
position:relative;
z-index: 20;
box-shadow: 0 0 10px white;
}
.scrollable {
position:relative;
overflow:hidden;
width: 100%;
height: 100%;
box-shadow: 0 0 20px purple;
/* height:198px; */
z-index: 20;
}
.scrollable .items {
/* this cannot be too large */
width:1000%;
position:absolute;
clear:both;
box-shadow: 0 0 30px green;
}
.items div {
float:left;
width:10%;
height:100%;
}
/* single scrollable item */
.scrollable img {
float:left;
width:100%;
height: auto;
/* height:198px; */
}
/* active item */
.scrollable .active {
border:2px solid #000;
position:relative;
cursor:default;
}
if your element mustn't be position:relative, i'd do like that
.scrollable {
position:absolute; // instead of relative
overflow:hidden;
width: 100%;
top:0;
bottom:0;// instead of height: 100%;
box-shadow: 0 0 20px purple;
/* height:198px; */
z-index: 20;
}
basically I defined the position as absolute, and added the fact the element begins at zero from top and at zero from bottom, which would be equivalent to height:100%;

Resources