Designer going to CSS. Fundamental flaws with links in nested centered divs - css

I want to set up a full width slideshow based on the Design I've prepared. I'm building the page on the Unsemantic CSS framework as I was already familiar with 960 gridsystem (960.gs).
What I'm missing is how to write physically correct HTML & CSS. I don't want to build these unstable workarounded glued pages like most.
I've tried my best to build it but nothing seems to work the way it should. Here is a part of the page where a slideshow should appear.
However, it looks like this.
Here's the CCS:
<style>
.slide-wrapper{
background-color:black;
width:100%;
overflow:hidden;
}
.slide-item{
width:100%;
overflow:hidden;
color:white;
}
.slide-img-wrapper{
position:relative;
}
.slide-img{
width:100%;
float:left;
position:relative;
}
.slide-description{
position:absolute;
float:left;
text-align:center;
width: 100%;
margin-top:16%;
}
.description-wrapper{
}
</style>
<div id="slide-wrapper">
<div class="slide-item">
<img class="slide-img" src="../villas.praivit/img/lead.jpg" />
<div class="slide-description">
<p class="location">SWITZERLAND, CERN</p>
<h1>VILLA PANORAMA</h1>
<p class="details">Local Time <b>4:10 am</b>, Temperature <b>32F°</b></p>
<div class="button-1">VIEW VILLA</div>
</div>
</div>
</div>

Is this what you are looking for?
<div id="slide-wrapper">
<div class="slide-item">
<img class="slide-img" src="http://dreamatico.com/data_images/mountain/mountain-1.jpg" />
<div class="slide-description">
<p class="location">SWITZERLAND, CERN</p>
<h1>VILLA PANORAMA</h1>
<p class="details">Local Time <b>4:10 am</b>, Temperature <b>32F°</b></p>
<div class="button-1">VIEW VILLA</div>
</div>
</div>
</div>
.slide-wrapper{
background-color:black;
width:100%;
overflow:hidden;
}
.slide-item{
width:100%;
overflow:hidden;
color:white;
}
.slide-img-wrapper{
position:relative;
}
.slide-img{
width:100%;
float:left;
position:relative;
}
.slide-description{
position:absolute;
float:left;
text-align:center;
width: 100%;
margin-top:16%;
}
.description-wrapper{
}
.button-1{
display: inline-block;
background-color: #b8955d;
color: #fff;
box-sizing: border-box;
padding: 10px;
}
.button-1 a{
color: #fff;
text-decoration: none;
}

Related

Is it possible to do a concave and rounded corner of the same element?

I need it to look like this:
Here is the markup:
<div class="hni_vaBreadcrumbContainer">
<progress class="hni_vaBreadcrumbProgress" value="0" max="100"></progress>
<span class="hni_vaBreadcrumbContent">0%</span>
</div>
Here are a couple jfiddles I tried but couldn't get working:
http://jsfiddle.net/x4wLf/, http://jsfiddle.net/cogent/6A5Lb/
I could just use a background image for the percentage text but prefer all CSS.
thanks!
I think I actually figured it out with very little markup/css.
http://jsfiddle.net/o22b4uyz/2/
Markup
<div class='wrapper'>
<div class='concave'><span class="percent">20%</span></div>
</div>
CSS
div.wrapper {
background:blue;
width:80px;
height:20px;
position:relative;
border-radius: 50px;
}
div.concave {
position:absolute;
background:white;
width:20px;
height:20px;
border-radius:50px;
left:-3px;
}
span.percent {
padding-left: 40px;
color: #fff;
}

css footer background didn't shows properly in html5

Here is my css code:
.footer{
clear:both;
background:url('../img/footer-bg.jpg');
overflow: hidden;
}
.footer-left{
float:left;
width: 50%;
}
.footer-right{
float:right;
width:50%;
}
.footer-nav .list-1 {
font-size:13px;
font-weight:600;
text-align: center;
}
.footer-nav .list-2 {
font-size:12px;
font-weight:600;
text-align: center;
}
.footer-nav ul li{
display:inline;
padding:8px;
}
.copyright{
font-size:13px;
text-align: center;
}
Here is my JSfiddle link: http://jsfiddle.net/3jet0dfu/12/
May i know how to set background image to 100% attached with window screen.and the footer content need to display right of image.
Now i added <hr /> line for footer-left and footer-right at the top and bottom.
But it shows at the top only, Can anybody help me exact css style to fix this.
I need look like this http://s30.postimg.org/gvqtdrmqp/article_page4.jpg.
Thanks in advance.
add to css
header,section{
margin:0 auto;
width:939px;}
and edit body css like this
body{
font-family: Raleway, sans-serif;
}
this working page jsfiddle
remove the 2 and replace the following html and add the css
<div id="footer-holder">
<div class="footer-left">
<img src="http://s18.postimg.org/itr24b7s9/footer1.png" alt="footer-image" />
<div class="footer-content">
<p class="footer-title">.NET Training</p>
<p class="footer-pgf">Less of boring theory! Hands on programming is our training methodology! You'll love it.<p>
learn more
</div>
</div>
<div class="footer-right">
<img src="http://s18.postimg.org/gl8a98bah/footer2.png" alt="footer-image" />
<div class="footer-content">
<p class="footer-title">Shopify Expert at $20/hour</p>
<p class="footer-pgf">Unique custom made shopify theme and tweakss. Strat selling online with stunning eCommerce storefronts created using the Shopify CMS</p>
learn more
</div>
</div>
<div style="clear:both"></div>
</div>
#footer-holder{
-webkit-border-image:url(border.png) 30 30 round; /* Safari 3.1-5 */
-o-border-image:url(border.png) 30 30 round; /* Opera 11-12.1 */
border-image:url(border.png) 30 30 round;
border-left:none;
border-right:none;
width: 100%;
}

Having trouble with 0 height div, but no floats. What can I do?

http://www.walkerspencer.com/chrhsweb/max
So I'm currently working on a high school project, and I'm completely stumped. One of my divs, article, isn't behaving how I'd like it to. It has a height of 0. Now, after a lot of googling and research, it seemed like this was a common issue... for containers which contained floating elements. My article contains no floating divs. I even tried removing float from the css for my #buttons div, and it had no effect. I've also tried most of the suggested float fixes: the clearfix method, clear:both. At this point, I just need an outside opinion. I couldn't find any major errors in my code (besides a general disorganization and misuse of semantic elements). The intended behavior is that sections scale while maintaining a 16:9 ratio as the browser resizes, and have a black transparent background that fills the entire article. I could also apply the background to article, but article doesn't have a height either. If you'd just like to critique my bad code habits and formatting, that's alright too :). The images' absences shouldn't be important, though they are in a 16:9 ratio, and I had this problem before adding any jquery. Thank you so much. Sorry if there's an issue with my post or how I've asked it, it's my first time asking a question on here.
HTML:
<head>
<meta charset='utf-8'/>
<title>design</title>
<link rel="stylesheet" type="text/css" href="reset.css"/>
<link rel="stylesheet" type="text/css" href="style.css"/>
<link href='http://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.cycle.all.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#images").cycle({
containerResize: false,
slideResize: false,
fit: 1
});
$('article').cycle({
activePagerClass: 'activeSlide',
containerResize: false,
slideResize: false,
fit: 1,
timeout: 0,
speed: 300,
startingSlide:0,
pager: "#buttons",
pagerAnchorBuilder: function(idx, slide) {
return '#buttons li:eq(' + idx + ')';}
});
$('#right').click(function() {
$('article').cycle("next");
return false;
});
$('#left').click(function() {
$('article').cycle("prev");
return false;
});
});
</script>
</head>
<body>
<div id="container">
<div id="arrows">
<div id="left"><</div><div id="right">></div>
</div>
<nav>
<ul id="buttons">
<li>
<li>
<li>
<li>
<li>
</ul>
</nav>
<div class="fix"></div>
<article>
<section id="images">
<img src="images/alaska.jpg" width="100%" height="auto"/>
<img src="images/field.jpg" width="100%" height="auto"/>
<img src="images/sunset.jpg" width="100%" height="auto"/>
</section >
<section id="about">
<p>
my name is <span style="color:crimson">max</span>.<br>
i'm a senior in high school.<br>
i love <span style="color:yellow">code</span><br>
<span style="color:#a45bc4">&</span><br>
i love <span style="color:lightgreen">design</span>.<br>
<span style="color:#a45bc4">welcome to my site.</span>
</p>
</section >
<section id="work">
</section >
<section id="contact">
</section>
<section id="place">
</section>
</article>
<div id="bottom"></div>
</div>
</body>
CSS:
body{
background-image:url("images/clouds.jpg");
background-size:cover;
background-color:white;
background-repeat:no-repeat;
height:100%
}
#container{
width:70%;
min-height:103px;
margin:0 auto;
min-width:182px;
}
#arrows{
max-width: 140px;
height: 70px;
background: #f7f7f7;
-moz-border-radius: 70px 70px 0 0;
-webkit-border-radius: 70px 70px 0 0;
border-radius: 70px 70px 0 0;
margin:auto;
position:relative;
top:25px;
z-index:100;
border-top:1px solid;
border-color:#cccccc;
font-family:"Lato";
text-align:center;
vertical-align:middle;
line-height:60px;
font-size:68px;
color:#cfcfcf;
font-weight:100;
font-stretch:ultra-condensed;
}
#right:hover, #left:hover{
color:#a45bc4;
text-decoration:none;
}
#right, #left{
display:inline;
color:#cfcfcf;
text-decoration:none;
cursor:pointer;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
nav{
width:calc(100%-2px);
border-left:1px solid #cfcfcf;
border-right:1px solid #cfcfcf;
height:35px;
background-color:#f7f7f7;
min-width:182px;
}
#buttons{
position:relative;
float:right;
margin-right:6px;
z-index:100;
}
.fix{
clear:both;
}
.current{
padding-right:0px;
}
#buttons li{
display:inline-block;
height:26px;
width:26px;
background-image:url("images/navc.jpg");
background-repeat:no-repeat;
background-position:center;
background-size:24px;
margin-left:8px;
margin-top:4px;
vertical-align:middle;
cursor:pointer;
}
#buttons li:hover{
opacity:.8;
}
#buttons a{
color:black;
text-decoration:none;
}
#buttons li.activeSlide{
background-image:url("images/violetc.jpg");
height:26px;
width:26px;
background-size:26px;
vertical-align:middle;
}
article{
width:100%;
min-width:184px;
height:100%;
}
section{
height:100%;
width:100%;
margin:0 auto;
text-align:center;
vertical-align:middle;
color:white;
font-weight:100;
font-size:36px;
font-family:"Lato";
background-color:rgba(0,0,0,.4);
}
p{
}
#about{
}
.option img{
opacity:.6
}
.option:hover{
opacity:.8;
}
#bottom{
border-left:1px solid #cfcfcf;
border-right:1px solid #cfcfcf;
border-bottom:1px solid #cfcfcf;
height:30px;
background-color:#f7f7f7;
min-width:182px;
margin-top:56.25%;
}
#media all and (max-width:690px){
#buttons{
margin-top:2px;
width:98%;
text-align:center;
}
nav{position:relative;
text-align:center;}
}
If you're keeping the slideshow plugin, and it is what's causing the absolutely positioned children (you're not doing it,) then your only option is to force the height of the article element, if you want to use it for something.
You can either apply a class/ID to it (if you're using other article elements that have nothing to do with this style, and you only use it once per page, then use an ID, or if you want to re-use it somewhere else on the same page, use a class.) So you would have something like:
article.slideshow-container { height: 498px; }
And you can then use it for whatever you want. This is a fixed-height though, so if image height changes, you lose out again.
The problem is definitely with your implementation of the jQuery Cycle Plugin. As setek has mentioned, the slideshow makes your section divs position absolute, which collapses the height of the article element to 0. You can add the following to your cycle script to dynamically adjust the height for each slide/section:
before : function(currSlideElement, nextSlideElement){
$('article').css('height', $(nextSlideElement).height()+'px');
},
You should also clean up your code (it is a bit of a mess) and try to take things step by step. I have created a working example for you here:
http://jsfiddle.net/BCyD8/
You will have to work a bit to get the spacing right.

Preventing Div Elements From Wrapping in a Fluid Navigation

I have a top nav that extends across the page
Within that top nav I have various elements
two that must align left
one that must align right
The nav is fluid the elements are fixed widths
Do not want the elements to wrap when the browser window is minimized
Needs to work in IE6 on up due to high Chinese audience.
See example here:
http://jsfiddle.net/4SUwg/
<div id="header">
<div id="headerContent">
<div class="search-list"> Search List </div>
<div class="social-buttons"> Social </div>
<div class="signin"> Login Drop Down </div>
</div>
</div>
I would like the div elements within the nav to not wrap. I searched around on stack and could find answers that come close but nothing that completely addressed the issue. My need to have the div element aligned right complicates matters. Must work in all browsers, especially IE's.
Thanks all for your help in advance!!!
Use SPAN .. It's INLINE and not BLOCK ??
<div id="header">
<div id="headerContent">
<span class="search-list"> Search List </span>
<span class="social-buttons"> Social </span>
<span class="signin"> Login Drop Down </span>
</div>
</div>
And your CSS, remove floats
<style>
body {
margin:0;
padding:0;
}
#header {
background: #404040;
height: 35px;
color: white;
margin: 0 0 12px 0;
overflow-x:auto; overflow-y:hidden;
}
#headerContent {
height: 32px;
border:1px dashed #fff;
}
.search-list {
width:150px;
background:#039;
}
.social-buttons {
width:150px;
background:#060;
}
.signin {
width:200px;
background:#F00;
}
You want a fluid layout but the most important rule of a fluid layout is not to set a definite width of elements but you have set the width.
The CSS have a <style> tag, which is not required, probably you put it by mistake.
I have set the width of divs inside headerContent in percentage value. The CSS is
body {
margin:0;
padding:0;
}
#header {
background: #404040;
height: 35px;
color: white;
margin: 0 0 12px 0;
overflow-x:auto; overflow-y:hidden;
}
#headerContent {
height: 32px;
border:1px dashed #fff;
}
.search-list {
width:28%;
float:left;
background:#039;
}
.social-buttons {
width:28%;
float:left;
background:#060;
}
.signin {
width:28%;
float:right;
background:#F00;
}
Just changed the width value and on my browser it looked fine, better than the before version. Here's a fiddle http://jsfiddle.net/DeepakKamat/s52Hn/8/
I found a solution that works in all browsers, specifically IE6 on up since that was a requirement for this project. If you have something better that accomplishes the same thing please post! My sincere thanks to everyone who answered/helped.
<div id="header2">
<table id="headerContent2">
<tr>
<td id="left" valign="top">
<div id="leftWrapper">
<div class="search-list2">Search List</div>
<div class="social-buttons2">Social Buttons</div>
</div>
</td>
<td id="middle"> </td>
<td id="right" valign="top">
<div class="signin2">Login Drop Down</div>
</td>
</tr>
</table>
</div>
<style>
#header2 {
background: #404040;
height: 35px;
color: white;
margin: 0 0 12px 0;
}
#headerContent2 {
width:100%;
}
#headerContent2 td {
height: 32px;
padding:0;
margin:0;
}
.search-list2 {
width:150px;
float:left;
background:#039;
}
.social-buttons2 {
width:200px;
float:left;
background:#060;
}
.signin2 {
background:#F00;
float:right;
width:400px;
}
#leftWrapper {
width:400px;
}
#middle {
width:100%;
}
</style>
See Demo of it working here. Copy the code and try it out in all the IE's since JSfiddle does not work in all IE's.
http://jsfiddle.net/GtXKE/

Why does the background of my container/wrapper not extend behind all content

Im working on a portfolio for uni and the background of my container / wrapper does not extend vertically enough in order for all its content to have a back ground color. I'll post code below, any help would be appreciated.
HTML
<body>
<section id="wrapper">
<header>
<hgroup class="title">
<h1>Matt Murphy</h1>
<p>Personal Portfolio | University of Leeds | BA New Media</p>
</hgroup>
</header>
<nav>
Home
About Matt
</nav>
<section id="modules">
<h2>Modules Studies To Date</h2>
<section id="year_1">
<h3>Year 1</h3>
<p>History of Communications</p>
<p>Academic Skills and Contemporary Issues</p>
<p>Interface Design</p>
<p>Design For New Media</p>
<p>Basic Camera and Editing</p>
<p>Animation For New Media</p>
</section>
<section id="year_2">
<h3>Year 2</h3>
<p>Dynamic Web Programming</p>
<p>Communications Research Methods</p>
<p>Working in New Media/p>
<p>Media Policy</p>
<p>New Media Narrative and Gaming</p>
<p>Visual Communications</p>
</section>
</section>
</section>
</body>
CSS
body{
color:#000;
background-image: url(images/canvas.png);
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
}
a:link {
text-decoration:none;
color:#000;
}
a:visited {
text-decoration:none;
color:#000;
}
a:hover {
text-decoration:none;
color:#000;
}
a:active {
text-decoration:none;
color:#000;
}
#wrapper {
background-color:#FFF;
padding:3%;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
display:block;
margin:auto;
width:60%;
margin-top:2%;
}
header {
text-align:right;
}
#modules {
width:100%;
display:block;
margin:auto;
}
#year_1 {
float:left;
}
#year_2 {
float:left;
}
To fix your problem you just need to add overflow: auto to #wrapper.
#wrapper {
background-color:#FFF;
padding:3%;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
display:block;
margin:auto;
width:60%;
margin-top:2%;
overflow: auto; /* add this line */
}
However, another issue is that you are using HTML5 elements and the HTML5 shiv but you have not used the HTML5 doctype:
<!DOCTYPE html>
I assume you are having problems in IE? You are missing a doctype declaration. If you add a transitional doctype as per the example on W3Schools below it should work.
HTML doctype declaration
Basically the css-property 'float' on the section#year is the bad guy here.
If I replace your sections with div's and add an extra div to clear block rendering it works:
http://jsfiddle.net/hoedinie/537sL/1/

Resources