css3 horizontal accordion not functioning - html

I know that the problem lies somewhere in my CSS3, but as a novice I simply can't work out what I am doing wrong with this. What I am trying to do is set up a horizontal accordion using only CSS3 and HTML5.
The effect I want to create is labels on the right, rotated 90deg until selected. selected labels I want to have rotate back to 0deg which I can do fine and to reveal their content which I am placing in article tags transitioning in from the right, ie transform: width 0.3s ease-out; to fill the full width of the containing div element.
This is the HTML -
<header>
<h1>Weedy101</h1>
</header>
<div class="horizontal">
<div class="side">
<input id="trig-a" name="trigger" type="radio" />
<label for="trig-a">This is trig-a's rotated label</label>
<article class="wide">
<h3>This is the content in trig-a</h3>
<p>I am keeping my fingers crossed but expect no mirracles on my first attempt considering I have never attempted a horizontal accordion before and the only examples I have seen use js.</p>
</article>
</div><!-- close the horizontal box -->
<div class="side">
<input id="trig-b" name="trigger" type="radio" checked="yes" />
<label for="trig-b">label for trig-b</label>
<article class="wide">
<h3>trig-b</h3>
<p>Just so it's different</p>
</article>
</div><!-- close the horizontal box -->
</div><!-- Close the new horizontal accordion -->
and this is my css -
.horizontal
{
margin: 10px auto 30px auto;
display: inline-block;
position: relative;
min-width: 100%;
min-height: 450px;
}
.horizontal label
{
font-family: 'News Cycle', sans-serif;
font-weight: normal;
padding: 5px 20px;
position: relative;
width: 450px;
z-index: 20;
display: inline-block;
cursor: pointer;
color: #0e3062;
text-shadow: -1px 1px 1px #677283;
line-height: 1.6em;
font-size: 1.5em;
background: linear-gradient(top, rgba(165,176,161,0.7) 2%, rgba(255,240,231,0.8) 46%, rgba(190,176,177,0.7) 98%);
background: linear-gradient(to bottom, rgba(165,176,161,0.7) 2%, rgba(255,240,231,0.8) 46%, rgba(190,176,177,0.7) 98%);
background: linear-gradient(rgba(165,176,161,0.7) 2%, rgba(255,240,231,0.8) 46%, rgba(190,176,177,0.7) 98%);
background: -webkit-linear-gradient(top, rgba(165,176,161,0.7) 2%, rgba(255,240,231,0.8) 46%, rgba(190,176,177,0.7) 98%);
box-shadow: 0px 0px 0px 1px rgba(191,183,178,1),
1px 0px 0px 0px rgba(190,176,177,1),
0px 2px 2px 0px rgba(34,34,34,1);
transform:rotate(90deg);
-webkit-transform:rotate(90deg);
-ms-transform:rotate(90deg);
}
.horizontal label:hover,
.horizontal input:checked + label:hover
{
color: #74450f;
text-shadow: -1px 1px 1px #9b8e76;
background: linear-gradient(top, rgba(165,176,161,0.5) 1%, rgba(255,240,231,0.9) 46%, rgba(190,176,177,0.5) 99%);
background: linear-gradient(top, rgba(165,176,161,0.5) 1%, rgba(255,240,231,0.9) 46%, rgba(190,176,177,0.5) 99%);
background: linear-gradient(top, rgba(165,176,161,0.5) 1%, rgba(255,240,231,0.9) 46%, rgba(190,176,177,0.5) 99%);
background: -webkit-linear-gradient(top, rgba(165,176,161,0.5) 1%, rgba(255,240,231,0.9) 46%, rgba(190,176,177,0.5) 99%);
box-shadow: 0px 0px 0px -1px rgba(191,183,178,0.7),
-1px 0px 0px 0px rgba(190,176,177,0.7),
0px -2px -2px 0px rgba(34,34,34,0.7);
}
.horizontal input:checked + label
{
color: #74450f;
text-shadow: -1px 1px 1px #9b8e76;
line-height: 2.0625em;
font-size: 1.1875em;
background: linear-gradient(top, rgba(165,176,161,1) 3%, rgba(255,240,231,1) 48%, rgba(190,176,177,1) 99%);
background: linear-gradient(to bottom, rgba(165,176,161,1) 3%, rgba(255,240,231,1) 48%, rgba(190,176,177,1) 99%);
background: linear-gradient(rgba(165,176,161,1) 3%, rgba(255,240,231,1) 48%, rgba(190,176,177,1) 99%);
background: -webkit-linear-gradient(top, rgba(165,176,161,1) 3%, rgba(255,240,231,1) 48%, rgba(190,176,177,1) 99%);
box-shadow: 0px 0px 0px 2px rgba(191,183,178,1),
2px 0px 0px 0px rgba(190,176,177,1),
0px 4px 4px 0px rgba(34,34,34,1);
transform:rotate(0deg);
-webkit-transform:rotate(0deg);
-ms-transform:rotate(0deg);
}
.horizontal input
{
display: none;
}
.horizontal article
{
background: #ffffff;
padding: 0px 15px 0px 15px;
margin-top: -1px;
overflow: hidden;
width: 0px;
height: 0em;
position: relative;
display: inline-block;
z-index: 10;
transition: width 0.5s ease-in;
box-shadow: 0px 0px 0px 2px rgba(191,183,178,1);
transform:rotate(90deg);
-webkit-transform:rotate(90deg);
-ms-transform:rotate(90deg);
}
.horizontal article p,
.horizontal article h3
{
padding: 5px;
text-shadow: -1px 1px 1px #647881;
}
.horizontal input:checked ~ article.wide
{
max-width: 45em;
width: 100%;
height: 45em;
transform: rotate(0deg);
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
}
and for good measure here it is doing weird things -http://weedy101.netii.net/horizontal.html
Any help with this would be greatly appreciated, my next stage will be to nest this horizontal accordion inside my working vertical CSS only accordion, but I need to get it working independently first.

Related

A round checkbox isn't working correctly on mobile device

I have some code which creates a 'round' checkbox effect.
It works fine on my desktop PC but on a mobile device unless you 'touch' in exactly the right place (at the bottom right-hand side) then the checkbox doesn't activate.
I just wondered if anyone knew how to make this code more robust in a mobile device or am I stuck using a media query to put a normal checkbox in for mobile users?
I have set up a codePen here so you can see the effect.
The HTML is this:
<section title="JTroundCheckbox">
<div class="JTroundCheckbox">
<input type="checkbox" value="<?php echo $value; ?>" name="checkbox1" id="checkbox1">
<label for="checkbox1"></label>
</div>
</section>
The CSS is this:
.JTroundCheckbox {
width: 28px;
height: 28px;
position: relative;
margin: 20px auto;
background: #fcfff4;
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(to bottom, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5);
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0, 0, 0, 0.5);
}
.JTroundCheckbox label {
width: 20px;
height: 20px;
position: absolute;
top: 4px;
left: 4px;
cursor: pointer;
background: -moz-linear-gradient(top, #222222 0%, #45484d 100%);
background: -webkit-linear-gradient(top, #222222 0%, #45484d 100%);
background: linear-gradient(to bottom, #222222 0%, #45484d 100%);
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 50px;
-moz-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white;
-webkit-box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white;
box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.5), 0px 1px 0px white;
}
.JTroundCheckbox label:after {
content: '';
width: 9px;
height: 5px;
position: absolute;
top: 5px;
left: 4px;
border: 3px solid #fcfff4;
border-top: none;
border-right: none;
background: transparent;
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0);
opacity: 0;
-moz-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.JTroundCheckbox label:hover::after {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=30);
opacity: 0.3;
}
.JTroundCheckbox input[type=checkbox] {
visibility: hidden;
}
.JTroundCheckbox input[type=checkbox]:checked + label:after {
filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false);
opacity: 1;
}
This is code that took from the net from here. (example labelled ROUNDED TWO in the code)
Many thanks for any light you can shed on this.
What about something like this? http://codepen.io/nathanw/pen/PwrNLz
I removed the hidden attribute from the checkbox and positioned it directly 'underneath' the fancy checkbox. It seems to work fine on an iPad.
.JTroundCheckbox input[type=checkbox] {
/* visibility: hidden; */
position: relative;
top:4px;
left:4px;
}

How do I change the color and style of radio buttons

I have a code to modify but it is not working
HTML
<input type="radio" id="radio-1-1" name="radio-1-set" class="regular-radio" checked />
Css
.regular-radio:checked:after {
content: ' ';
width: 12px;
height: 12px;
border-radius: 50px;
position: absolute;
top: 3px;
background: #99a1a7;
box-shadow: inset 0px 0px 10px rgba(0,0,0,0.3);
text-shadow: 0px;
left: 3px;
font-size: 32px;
}
.regular-radio:checked {
background-color: #e9ecee;
color: #99a1a7;
border: 1px solid #adb8c0;
box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px -15px 10px -12px rgba(0,0,0,0.05), inset 15px 10px -12px rgba(255,255,255,0.1), inset 0px 0px 10px rgba(0,0,0,0.1);
}
I need radio box like :-
Let me know how can I do this ?
Thanks.
It is possible in css, but not for all the browsers.
The effect on all browsers:
http://www.456bereastreet.com/lab/form_controls/checkboxes/
A possibility is a custom checkbox with javascript, example:
http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/
You can do it without javascript.
By default HTML works so that your label will trigger the input. This means that you can hide your input, and put a psudo element on you label. In that way you can style whatever radio button / checkbox you would like.
Now I didn't test the below code, put it should be close to this.
By the way. The reason for not displaying none on the input, is because it makes IOS crash, for some reason.
<label for="test">
<input type="radio" id="test" />
</label>
CSS
input {
position: absolute;
left: - 999em;
}
label {
position relative;
padding-left: 30px;
}
label:before {
content: "";
display: block;
height: 10px;
width: 10px;
background: url(yourBackgroundImage.png) no-repeat 0 0;
position: absolute;
left: 0;
top: 2px;
}
I think it is a rounded check box. Not a radio button. Here is how it did.
Here is the jsfiddle: http://jsfiddle.net/X55am/
Here is some extra: http://codepen.io/bbodine1/pen/novBm
html
<div class="roundedTwo">
<input type="checkbox" value="None" id="roundedTwo" name="check" />
<label for="roundedTwo"></label>
</div>
css
body {
background: #555;
}
input[type=checkbox] {
visibility: hidden;
}
/* ROUNDED TWO */
.roundedTwo {
width: 28px;
height: 28px;
background: #fcfff4;
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
margin: 20px auto;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
-webkit-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
-moz-box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
box-shadow: inset 0px 1px 1px white, 0px 1px 3px rgba(0,0,0,0.5);
position: relative;
}
.roundedTwo label {
cursor: pointer;
position: absolute;
width: 20px;
height: 20px;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
left: 4px;
top: 4px;
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,1);
background: -webkit-linear-gradient(top, #222 0%, #45484d 100%);
background: -moz-linear-gradient(top, #222 0%, #45484d 100%);
background: -o-linear-gradient(top, #222 0%, #45484d 100%);
background: -ms-linear-gradient(top, #222 0%, #45484d 100%);
background: linear-gradient(top, #222 0%, #45484d 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#222', endColorstr='#45484d',GradientType=0 );
}
.roundedTwo label:after {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
filter: alpha(opacity=0);
opacity: 0;
content: '';
position: absolute;
width: 9px;
height: 5px;
background: transparent;
top: 5px;
left: 4px;
border: 3px solid #fcfff4;
border-top: none;
border-right: none;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.roundedTwo label:hover::after {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
filter: alpha(opacity=30);
opacity: 0.3;
}
.roundedTwo input[type=checkbox]:checked + label:after {
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
filter: alpha(opacity=100);
opacity: 1;
}

Style to make a slider instead than checkbox not working even if I override the inline eelement.style

my goal is to put this slide (the third slide) in this site in the comment boxes.
I took the original CSS code, and I replaced the classes. This is the final CSS you can see now live..
All seems to be fine, apart from the fact that label text doesn't appear next to the checkbox.
Here it is:
<label class="subscribe-label" id="subscribe-label" for="subscribe_comments" style="display: inline;">Powiadom mnie o kolejnych komentarzach przez email.</label>
The above bold text should show next to the checkbox.
The problem is that I cannot edit the html... I have only access to the CSS. In the CSS I already put the !important to override the styles applied inline.
Does anybody know whether it is feasible to achieve it?
P.s. here is a fiddle for tests.
Your label content needs to go here:
Content in CSS
.ondisplay section::before {
content:'Powiadom mnie o kolejnych komentarzach przez email.';
}
HTML
<div class="ondisplay">
<section>
<!-- Slide THREE -->
<div class="slideThree">
<input type="checkbox" value="None" id="slideThree" name="check" checked />
<label for="slideThree"></label>
</div>
</section>
</div>
CSS
body {
background: #555;
}
h1, h2 {
color: #eee;
font: 30px Arial, sans-serif;
-webkit-font-smoothing: antialiased;
text-shadow: 0px 1px black;
text-align: center;
margin: 20px 0 50px 0;
}
/* SLIDE THREE */
.slideThree {
width: 80px;
height: 26px;
background: #333;
margin: 20px auto;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
position: relative;
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
}
.slideThree:after {
content: 'OFF';
font: 12px/26px Arial, sans-serif;
color: #000;
position: absolute;
right: 10px;
z-index: 0;
font-weight: bold;
text-shadow: 1px 1px 0px rgba(255,255,255,.15);
}
.slideThree:before {
content: 'ON';
font: 12px/26px Arial, sans-serif;
color: #00bf00;
position: absolute;
left: 10px;
z-index: 0;
font-weight: bold;
}
.slideThree label {
display: block;
width: 34px;
height: 20px;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-o-transition: all .4s ease;
-ms-transition: all .4s ease;
transition: all .4s ease;
cursor: pointer;
position: absolute;
top: 3px;
left: 3px;
z-index: 1;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
background: #fcfff4;
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
}
.slideThree input[type=checkbox]:checked + label {
left: 43px;
}
input[type=checkbox] {
visibility: hidden;
}
.ondisplay{
text-align:center;
border-bottom:1px solid gray;
padding:20px 0;
}
.ondisplay section{
width:100px;
height:100px;
background: #555;
display:inline-block;
border: 1px solid gray;
text-align: center;
margin-top:5px;
border-radius:5px;
box-shadow: 0 1px 4px
rgba(0, 0, 0, 0.3), 0 0 40px
rgba(0, 0, 0, 0.1) inset;
}
.ondisplay section::before {
content:'Powiadom mnie o kolejnych komentarzach przez email.';
color: #bbb;
font: 15px Arial, sans-serif;
-webkit-font-smoothing: antialiased;
text-shadow: 0px 1px black;
}
input[type=checkbox] {
visibility: hidden;
}}
Example
jsFiddle example: http://jsfiddle.net/CXn3v/

Facebook like box margins do not center

I'd like to think that I an intermediate when it comes to HTML and CSS but this is a huge problem I haven't been able to resolve.
I am building a website for a business and I can't seem to center the facebook social media plugin "like Box"
here is my html:
<!doctype html>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="../c9c.css">
<!-- TemplateBeginEditable name="doctitle" -->
<title>Cloud 9 CrossFit - Home</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head>
<body>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=141894429309879";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-40292409-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<nav>
<li>C9C</li>
<li>About Us</li>
<li>Schedule</li>
<li>Membership</li>
<li>WOD</li>
<li>Media</li>
<li>Links</li>
<li>Contact</li>
</nav>
<!-- TemplateBeginEditable name="EditRegion1" -->
<div id="container">
<div id="img"><img src="../img/image place holder.jpg" alt="" name="imgmain" width="983" height="435" id="imgmain"></div>
<div class="fb-like-box" data-href="https://www.facebook.com/Cloud9CrossFit" data-width="973" data-height="510" data-show-faces="true" data-stream="true" data-header="false"></div>
<div class="quickboxes">
<div id="box1"><img src="../img/Crossfit.png" width="960" id="img1" longdesc="http://www.navyreserve.navy.mil/Pages/default.aspx"></div>
<div id="box2"><img src="../img/Rogue logo" alt="rogue fitness" width="940" id="img2" ></div>
<div id="box3"><img src="../img/facebook logo.png" alt="facebook" width="73" id="img3"></div>
</div>
</div>
<!-- TemplateEndEditable -->
<footer>footer stuff | sitemap | etc | © 2013 Cloud 9 CrossFit</footer>
</body>
</html>
The CSS:
/* CSS Document */
body {
font: Calibri;
background-color: #EFEFEF;
width: 1120px;
height: auto;
margin: auto;
background-image:url(img/Name%20sideways.png);
background-position:0px 20px;
background-repeat:no-repeat;
background-attachment:fixed;
}
#fb-root {
display: none;
}
nav {
margin: 20px auto;
list-style: none;
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
font-weight:550;
letter-spacing: -0.5px;
font-size: 13px;
text-shadow: 0 -1px 3px ##E9E8E9;
width: 974px;
height: 30px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
border-radius: 4px;
-moz-box-shadow: 0px 3px 3px #cecece;
-webkit-box-shadow: 0px 3px 3px #cecece;
box-shadow: 0 3px 4px #8b8b8b;
text-align: center;
-webkit-animation: showMenu 1s;
position: relative;
color: white;
}
nav li {
display: block;
float: left;
border-right: 1px solid #999;
border-left: 1px solid #E9E8E9;
width: 120px;
height: 30px;
border-bottom: 1px solid #D5D5D5;
border-top: 1px solid ##F5F5F5;
background-image: linear-gradient(bottom, #999999 23%, #CFCDCF 57%, #F5F5F5 89%);
background-image: -o-linear-gradient(bottom, #999999 23%, #CFCDCF 57%, #F5F5F5 89%);
background-image: -moz-linear-gradient(bottom, #999999 23%, #CFCDCF 57%, #F5F5F5 89%);
background-image: -webkit-linear-gradient(bottom, #999999 23%, #CFCDCF 57%, #F5F5F5 89%);
background-image: -ms-linear-gradient(bottom, #999999 23%, #CFCDCF 57%, #F5F5F5 89%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.23, #999999),
color-stop(0.57, #CFCDCF),
color-stop(0.89, #F5F5F5)
);
background-color: #5f5f5f; /* Fallback */
margin:0 auto;
}
nav li:hover {
background-image: linear-gradient(bottom, #696869 23%, #8F8F8F 57%, #C7C7C7 89%);
background-image: -o-linear-gradient(bottom, #696869 23%, #8F8F8F 57%, #C7C7C7 89%);
background-image: -moz-linear-gradient(bottom, #696869 23%, #8F8F8F 57%, #C7C7C7 89%);
background-image: -webkit-linear-gradient(bottom, #696869 23%, #8F8F8F 57%, #C7C7C7 89%);
background-image: -ms-linear-gradient(bottom, #696869 23%, #8F8F8F 57%, #C7C7C7 89%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.23, #696869),
color-stop(0.57, #8F8F8F),
color-stop(0.89, #C7C7C7)
);
background-color: #383838; /* Fallback */
-moz-box-shadow: inset 0 1px 2px 2px #666;
-webkit-box-shadow: inset 0 1px 2px 2px #666;
box-shadow: inset 0 1px 2px 2px #666;
}
nav li:active {
background-image: linear-gradient(bottom, #262626 23%, #525052 57%, #C7C7C7 89%);
background-image: -o-linear-gradient(bottom, #262626 23%, #525052 57%, #C7C7C7 89%);
background-image: -moz-linear-gradient(bottom, #262626 23%, #525052 57%, #C7C7C7 89%);
background-image: -webkit-linear-gradient(bottom, #262626 23%, #525052 57%, #C7C7C7 89%);
background-image: -ms-linear-gradient(bottom, #262626 23%, #525052 57%, #C7C7C7 89%);
background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.23, #262626),
color-stop(0.57, #525052),
color-stop(0.89, #C7C7C7)
);
background-color: #383838; /* Fallback */
-moz-box-shadow: inset 0px 0px 5px 5px #31304A;
-webkit-box-shadow: inset 0px 0px 5px 5px #31304A;
box-shadow: inset 0 0 5px 5px #31304A;
}
nav li a {
color: black;
text-decoration: none;
text-align: center;
display: block;
line-height: 30px;
outline: none;
}
nav li:first-child {
-moz-border-radius: 4px 0 0 4px;
-webkit-border-radius: 4px 0 0 4px;
border-radius: 4px 0 0 4px;
border-left: none;
}
nav li:first-child a img {
vertical-align: middle;
margin-top: -2px;
}
nav li:last-child {
-moz-border-radius: 0 4px 4px 0;
-webkit-border-radius: 0 4px 4px 0;
border-radius: 0 4px 4px 0;
border-right: none;
}
/* Fade in animation (Webkit only) */
#-webkit-keyframes showMenu {
from {
opacity: 0;
top:-20px;
}
to {
opacity: 1;
}
#container {
width: 980px;
height:auto;
margin:auto;
}
#img {
width: 980px;
margin: 0 auto;
}
#imgmain {
display: block;
border-radius: 8px;
opacity: 0.8;
-moz-box-shadow: 0px 0px 10px #999;
-webkit-box-shadow: 0px 0px 10px #999;
box-shadow: 0px 0px 10px #999;
}
.fb-like-box {
display: block;
width: 980px;
height: auto;
text-align: center;
margin: 15px auto;
}
.quickboxes {
width: 974px;
margin: 0 auto;
}
#box1, #box2, #box3 {
width: 33%;
display: inline-block;
overflow: hidden;
margin: 15px auto;
text-align: center;
}
#img1, #img2 {
width: 60%;
margin: 5px auto;
}
footer {
height:18px;
width: 974px;
margin: 5px auto;
padding: 5px 0px;
text-align: center;
border-top: thin #999 solid;
border-bottom: thin #999 solid;
}
The problem is that while the image and link boxes are centered, the Facebook like box will not center.
I don't want to absolute position because if the user changes the window size it get's distorted. I know this is a margin issue. But I'm not sure why.
This is simple CSS stuff so why does it fail to work properly?
I was able to fix it by adding
padding-left: 70px;
Hi a slight modification of Stefan's answer did the trick for me:
div.fb-like {
width: 100% !important;
position: relative;
text-align:center !important;
}
<div class="fb-like disp_fb_like" data-send="false" data-layout="box_count" data-width="90" data-show-faces="false" data-action="recommend"></div>
I cheated a little when I was encountering this issue.
I created a new container to surround the likebox and had to set a width (for the vertical configuration at 292px) with auto left/right margins.
All of the above did not work for me.
The following did:
.fb-like-box, .fb-like-box span, .fb-like-box.fb_iframe_widget span iframe {
width: 100% !important;
position: relative;
text-align:center !important;
}
Wrap another div around the Facebook code and add this to it:
#facebook-box {width: 278px; display: block; margin: 0 auto;}
Set the width to the same width as your facebook like box.

CSS3 re-size page according to screen size / display

how can i get my page to align to fit into any any screen size, for example, take a look at this link for a better understanding https://dl.dropbox.com/u/8542058/Photo%20Jul%2012%2C%209%2056%2026.png
if you notice, on the link above, once the screen is adjusted, the image on the screen adjust it self and take the shape of the screen accordingly. now i want to do the same to my page, my demo page can be found on http://jsfiddle.net/529Lk/show/, and the codes are http://jsfiddle.net/529Lk/. thanks
for easy view my codes are still here:
CSS3:
body{
font-family: Arial, "MS Trebuchet", sans-serif;
color:#000;
background:#088A08;
font-weight: bold;
margin:auto;
}
/* SLIDE Start */
input[id=slideThree] {
visibility: hidden;
}
/* SLIDE THREE */
.slideThree {
width: 120px;
height: 45px;
background: #0101DF;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
position: relative;
-webkit-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
-moz-box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
box-shadow: inset 0px 1px 1px rgba(0,0,0,0.5), 0px 1px 0px rgba(255,255,255,0.2);
position:relative; left:450px;
}
.slideThree:after {
content: 'OFF';
font: 19px/26px Arial, sans-serif;
color: #fff;
position: absolute;
right: 10px;
z-index: 0;
font-weight: bold;
text-shadow: 1px 1px 0px rgba(255,255,255,.15);
}
.slideThree:before {
content: 'ON';
font: 19px/26px Arial, sans-serif;
color: #fff;
position: absolute;
left: 10px;
z-index: 0;
font-weight: bold;
}
.slideThree label {
display: block;
width: 50px;
height: 40px;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px;
-webkit-transition: all .4s ease;
-moz-transition: all .4s ease;
-o-transition: all .4s ease;
-ms-transition: all .4s ease;
transition: all .10s ease;
cursor: pointer;
position: absolute;
top: 3px;
left: 3px;
z-index: 1;
-webkit-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
-moz-box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
box-shadow: 0px 2px 5px 0px rgba(0,0,0,0.3);
background: #fcfff4;
background: -webkit-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -moz-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -o-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: -ms-linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
background: linear-gradient(top, #fcfff4 0%, #dfe5d7 40%, #b3bead 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfff4', endColorstr='#b3bead',GradientType=0 );
}
.slideThree input[type=checkbox]:checked + label {
left: 68px;
}
.back { width:598; height:95px; background:url('http://i1159.photobucket.com/albums/p637/Apulo_Cosmas/btn_push01c2x.png') no-repeat; }
HTML:
<div class="back" id="toggle"><br/>
<label for="enjoy_web"></label>
<div class="slideThree">
<input type="checkbox" value="None" id="slideThree" name="check" />
<label for="slideThree"></label>
</div>
</div>
<br/><br/><br/>
<img src="http://i1159.photobucket.com/albums/p637/Apulo_Cosmas/btn_push01a2x.png"/>​
​
If you mean If I were to shrink the browser, it would still fit? That is what you would call a fluid-width style. This can be done by using percentages on widths.
On the other hand, if you want to apply separate styles to your page depending on the screen resolution, then you can use media queries: http://webdesignerwall.com/tutorials/css3-media-queries