Pure CSS Read More/Less button not working - css

I am using Wordpress and trying to implement this code here: https://codepen.io/Idered/pen/AeBgF
HTML:
.read-more-state {
display: none;
}
.read-more-target {
opacity: 0;
max-height: 0;
font-size: 0;
transition: .25s ease;
}
.read-more-state:checked ~ .read-more-wrap .read-more-target {
opacity: 1;
font-size: inherit;
max-height: 999em;
}
.read-more-state ~ .read-more-trigger:before {
content: 'Show more';
}
.read-more-state:checked ~ .read-more-trigger:before {
content: 'Show less';
}
.read-more-trigger {
cursor: pointer;
display: inline-block;
padding: 0 .5em;
color: #666;
font-size: .9em;
line-height: 2;
border: 1px solid #ddd;
border-radius: .25em;
}
<div>
<input type="checkbox" class="read-more-state" id="post-2" />
<ul class="read-more-wrap">
<li>lorem</li>
<li>lorem 2</li>
<li class="read-more-target">lorem 3</li>
<li class="read-more-target">lorem 4</li>
</ul>
<label for="post-2" class="read-more-trigger"></label>
</div>
However, I am facing some problems - a grey line (that can be toggled) is appearing instead of the show more button - which is exactly what this user is also facing https://www.drupal.org/forum/support/post-installation/2016-10-14/read-more-toggle-pure-css-not-working-correctly
From the link directly above, you can see his and my problem here: http://www.monarchschool.org/test-toggle
Would appreciate any help on this - thanks in advance.

The problem is your label is not in the same level in your site. The operator ~ will target the siblings elements only, not their child or grandchild. Let me explain with the example. Look at the below code.
.test ~ .example {
background:green;
}
<p class="test">Test</p>
<p class="nothing">Nothing</p>
<p class="example">Example</p>
<p><span class="example">Second Level Example</span></p>
.test class now check all the sibling elements with class .example and apply the background color green. We have added one class .example for the second level. Your CSS will not target those elements. In your original code label comes under the p and that's why it is not added the content Show More for your label. One solution is to remove the p element and keep the label in the same level. Otherwise update your CSS like below to target the child elements.
.read-more-state ~ p > label.read-more-trigger:before {
content: 'Show more';
}
.read-more-state:checked ~ p > label.read-more-trigger:before {
content: 'Show less';
}
Here you go with your example as like as the live code.
.read-more-state {
display: none;
}
.read-more-target {
opacity: 0;
max-height: 0;
font-size: 0;
transition: .25s ease;
}
.read-more-state:checked ~ .read-more-wrap .read-more-target {
opacity: 1;
font-size: inherit;
max-height: 999em;
}
.read-more-state ~ p > label.read-more-trigger:before {
content: 'Show more';
}
.read-more-state:checked ~ p > label.read-more-trigger:before {
content: 'Show less';
}
.read-more-trigger {
cursor: pointer;
display: inline-block;
padding: 0 .5em;
color: #666;
font-size: .9em;
line-height: 2;
border: 1px solid #ddd;
border-radius: .25em;
}
<div>
<input type="checkbox" class="read-more-state" id="post-2" />
<ul class="read-more-wrap">
<li>lorem</li>
<li>lorem 2</li>
<li class="read-more-target">lorem 3</li>
<li class="read-more-target">lorem 4</li>
</ul>
<p><label for="post-2" class="read-more-trigger"></label></p>
</div>

I think you Just want this :)
.read-more-state {
display: none;
}
.read-more-target {
opacity: 0;
max-height: 0;
font-size: 0;
transition: .25s ease;
}
.read-more-state:checked ~ .read-more-wrap .read-more-target {
opacity: 1;
font-size: inherit;
max-height: 999em;
}
.read-more-state ~ .read-more-trigger:before {
content: 'Show more';
}
.read-more-state:checked ~ .read-more-trigger:before {
content: 'Show less';
}
.read-more-trigger {
cursor: pointer;
display: inline-block;
padding: 0px 10px;
color: #fff;
font-size: .9em;
line-height: 2;
border: 1px solid #dea119;
border-radius: 20px;
background-color: #b9890c;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(0,0,0,0.08);
}
/* Other style */
body {
padding: 2%;
}
p {
padding: 2%;
background: #0a0a0a;
color: #ffffff;
border: 1px solid #000000;
border-radius: .25em;
}
p:hover {
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(0,0,0,0.08);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<input type="checkbox" class="read-more-state" id="post-1" />
<p class="read-more-wrap">Lorem ipsum dolor sit amet, consectetur adipisicing elit. <span class="read-more-target">Libero fuga facilis vel consectetur quos sapiente deleniti eveniet dolores tempore eos deserunt officia quis ab? Excepturi vero tempore minus beatae voluptatem!</span></p>
<label for="post-1" class="read-more-trigger"></label>
</div>
<div>
<input type="checkbox" class="read-more-state" id="post-2" />
<ul class="read-more-wrap">
<li>Bootstrap</li>
<li>Javascript</li>
<li class="read-more-target">HTML 5</li>
<li class="read-more-target">Css 3</li>
</ul>
<label for="post-2" class="read-more-trigger"></label>
</div>

Related

CSS color-scheme selector or media query

Is it possible to write a media query or a CSS selector that would only apply when color-scheme is dark.
:root {
/*Special CSS variable see: https://twitter.com/diegohaz/status/1529543787311144961*/
color-scheme: dark;
}
:root {
--blue-france: #f5f5fe;
}
/* Psudo code, I know it isn't possible to use var in selectors, I just hope there is a way around it in this perticulat usecase. */
:root:where(var(color-scheme)="dark") {
/* Overwrite default value */
--blue-france: #1b1b35;
}
/* Alternative psudo code, it works with prefers-color-scheme but not with color-scheme */
#media screen and (color-scheme: dark) {
:root {
--blue-france: #1b1b35;
}
}
I'm open to alternative solutions as long as it doesn't involve JavaScript or setting attributes on the <head /> or <body />.
From what I understood you are looking for a dark mode without Javascript? Here is this code snippet based on this snippet for Dark Mode WITHOUT Javascript, just pure CSS.
/**
* VARIABLES
*/
:root {
--bg: #f8fafc;
--panel-bg: #FFFFFF;
--panel-border: #CCCCCC;
--panel-title: #343f44;
--panel-text: #54666d;
--btn: #3eb0ef;
}
/**
* GENERIC STYLES
*/
body {
position: relative;
height: 100vh;
padding: 0;
margin: 0;
font-family: 'Nunito Sans', sans-serif;
font-weight: 600;
}
/**
* TOGGLERS
*/
#toggleMode {
visibility: hidden;
}
.toggleDark,
.toggleLight {
cursor: pointer;
position: absolute;
z-index: 2;
top: 20px;
left: 20px;
}
.toggleDark {
display: block;
color: #222;
}
.toggleDark:hover {
color: blue;
}
.toggleLight {
display: none;
color: white;
}
#toggleMode:checked~.toggleDark {
display: none;
}
#toggleMode:checked~.toggleLight {
display: block;
}
#container {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--bg);
z-index: 1;
padding: 50px 20px;
}
#toggleMode:checked~#container {
--bg: #020202;
--panel-bg: #111413;
--panel-border: #1f2322;
--panel-title: #8e9294;
--panel-text: #505456;
--btn: #2962fe;
background-color: var(--bg);
}
/**
* PANEL
*/
.panel {
margin-top: 20px;
}
.panel .content h2 {
margin-top: 20px;
margin-bottom: 0;
color: var(--panel-title);
}
.panel .content p {
margin-top: 10px;
font-weight: 300;
color: var(--panel-text);
}
.panel .content button {
border: 0;
border-radius: 3px;
background-color: var(--btn);
padding: 10px 20px;
color: white;
cursor: pointer;
}
.panel .content button:hover {
opacity: 0.7;
}
<body>
<input type="checkbox" id="toggleMode">
<label for="toggleMode" class="toggleDark">Dark Mode</label>
<label for="toggleMode" class="toggleLight">Light Mode</label>
<div id="container">
<div class="panel">
<div class="content">
<h2>This is a title</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ullamcorper erat quis faucibus pulvinar. Duis vel ex non sem ultricies consectetur. Donec blandit dolor ac libero euismod, sit amet blandit libero scelerisque.</p>
<button>Read more</button>
</div>
<div style="clear:both"></div>
</div>
</div>
</body>

how to add tooltip for wordpress button?

I have tried with plugin its woking fine.
i need without plugin add some tooltip with css.
<div class="tooltip-text">Parent text
<span class="tooltiptext">Tooltip text here!</span>
</div>
styles:
.tooltip-box {
position: relative;
display: inline-block;
}
.tooltip-box .tooltip-text {
visibility: hidden;
width: 100px;
background-color: black;
color: #fff;
text-align: center;
padding: 6px 0;
position: absolute;
z-index: 1;
}
.tooltip-box:hover .tooltip-text {
visibility: visible;
}
if using some text contents it works fine.
now i m using buttons here
<div class="kt-btn-wrap kt-btn-wrap-2">
<a class="kt-button button kt-btn-2-action kt-btn-size-custom kt-btn-style-basic kt-
btn-svg-show-always kt-btn-has-text-true kt-btn-has-svg-false" >
<span class="kt-btn-inner-text">Tooltip Button</span>
</a></div></div>
if i use span class also didnt work. usual button style also changed. better solution suggest me Thank you
check this for button and text
.tooltip-text {
color:#000;
text-align: center;
padding: 6px 0;
position: absolute;
z-index: 1;
}
.tooltip-text .tooltiptext, .kt-btn-wrap .tooltiptext{visibility:hidden;}
.tooltip-text:hover .tooltiptext,
.kt-btn-wrap:hover span.tooltiptext{
visibility: visible;background-color: black;color:#fff;width:100%;
}
<div class="tooltip-text">Parent text
<span class="tooltiptext">Tooltip text here!</span>
</div><br><br>
<div class="kt-btn-wrap kt-btn-wrap-2">
<a class="kt-button button kt-btn-2-action kt-btn-size-custom kt-btn-style-basic kt-
btn-svg-show-always kt-btn-has-text-true kt-btn-has-svg-false" >
<span class="kt-btn-inner-text">Tooltip Button</span>
</a><span class="tooltiptext">Tooltip text here for button!</span></div>
Your actual code should work (granted you're fixing class names – your example code has some "deviations" ...).
Example 1
.kt-button {
position: relative;
display: inline-block;
}
.kt-btn-inline {
border: none;
appearance: none;
background-color: transparent;
padding: 0;
font-family: inherit;
font-size: inherit;
}
.kt-btn-inner-text,
.kt-btn-inner {
visibility: hidden;
width: 100px;
color: #fff;
text-align: center;
padding: 6px 0;
position: absolute;
z-index: 1;
}
.kt-btn-inner-text {
background-color: black;
color: #fff;
}
.kt-button:hover .kt-btn-inner {
visibility: visible;
}
<p>
<a class="kt-button button kt-btn-2-action kt-btn-size-custom kt-btn-style-basic kt-
btn-svg-show-always kt-btn-has-text-true kt-btn-has-svg-false">
Button Text (Link)
<span class="kt-btn-inner kt-btn-inner-text">Tooltip text</span>
</a>
</p>
<p>
<button class="kt-button kt-btn-inline button kt-btn-2-action kt-btn-size-custom kt-btn-style-basic kt-
btn-svg-show-always kt-btn-has-text-true kt-btn-has-svg-false">
Button Text (Button)
<span class="kt-btn-inner kt-btn-inner-text">Tooltip text</span>
</button>
</p>
<p>
<button class="kt-button kt-btn-inline button kt-btn-2-action kt-btn-size-custom kt-btn-style-basic kt-
btn-svg-show-always kt-btn-has-text-true kt-btn-has-svg-false">
Button image tooltip
<span class="kt-btn-inner"><img width="200" height="300" src="http://placekitten.com/g/200/300"></span>
</button>
</p>
So most likely there are some typos in your html or css.
The main concept is perfectly OK:
tooltip parent element has position:relative
tooltip text gets position: absolute and hidden visibility that's toggled on hover
Example 2: inlined tooltips
* {
box-sizing: border-box;
}
body {
font-family: "Segoe UI", sans-serif;
}
:root {
--border-radius: 0.3em;
--bg-color: rgba(0, 0, 0, 0.7);
--padding: 0.3em;
}
button {
appearance: none;
border: 1px solid #ccc;
padding: 0.3em;
font-size: 2em;
}
.layout {
width: 50%;
margin: 0 auto;
}
.tooltip {
position: relative;
}
span.tooltip {
font-weight: bold;
}
.tooltip-content:before {
content: "";
display: inline-block;
position: absolute;
border: var(--padding) solid transparent;
border-bottom-color: var(--bg-color);
top: calc((var(--padding) * 2 * -1));
left: 50%;
margin-left: calc(var(--padding) / 2 * -1);
border-radius: 0;
}
.tooltip-content {
position: absolute;
top: calc(100% - (var(--padding) * 2));
left: 50%;
z-index: 1;
visibility: hidden;
opacity: 0;
margin-top: calc(var(--padding) * 3);
transform: translateX(-50%);
display: block;
background-color: var(--bg-color);
width: calc(100% + var(--padding));
width: 100%;
min-width: 8em;
color: #fff;
text-align: center;
padding: var(--padding);
padding-top: calc(var(--padding) / 2);
border-radius: var(--border-radius);
transition: 0.3s;
font-size: 1rem;
line-height: 1.2rem;
vertical-align: baseline;
font-weight: normal;
}
.tooltip:hover .tooltip-content {
visibility: visible;
opacity: 1;
}
.tooltip-content-img {
padding: 0!important;
}
<div class="layout">
<button class="tooltip">Test button
<span class="tooltip-content">Tooltip text here!</span>
</button>
<p>Lorem ipsum dolor sit amet, <span class="tooltip">consectetuer adipiscing <span class="tooltip-content">Tooltip text here!</span></span> elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, <span class="tooltip">image <span class="tooltip-content tooltip-content-img"><img src="http://placekitten.com/g/200/300"></span></span> pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate</p>
</div>
Should work for any parent element. But you might have more specific css rules inherited by your theme or plugins (... uhm, wordpress). So you will need to inspect your computed styles in dev tools if you encounter any issues.

CSS animation needs correction

I would really appreciate your help if you could check below in the codepen my css animation.
I'm trying to make this work better. I want this underline to start from below the icon, not to be stuck to the window, but to have some space from right just under the first icon.
* {
box-sizing: border-box;
}
body {
font: 300 100% 'Helvetica Neue', Helvetica, Arial;
}
.container {
width: 100%;
margin: 0 auto;
}
ul li {
display: inline;
text-align: center;
}
a {
display: inline-block;
width: 25%;
padding: .75rem 0;
margin: 0;
text-decoration: none;
color: #333;
}
.two:hover ~ hr {
margin-left: 40%;
}
.one:hover ~ hr {
margin-left: 12.5%;
}
.three:hover ~ hr {
margin-left: 66%;
}
.four:hover ~ hr {
margin-left: 75%;
}
hr {
height: .25rem;
width: 20%;
margin: 0;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
.home-content-1{background-color: #F7F8F9; text-align: center;padding:5em 0em 2em;}
.home-content-1 .row{margin-top: 2em;}
.home-content-1 h3{font-weight: 700;text-transform: uppercase;color: #646464;font-size: 1.3125em;}
.hc-icon{width: 150px;height: 150px;border-radius: 50%;margin: 0px auto 2.25em;}
.hc-icon img{padding-top: 30px;}
.hc-icon1{background: #b5d73c;}
.hc-icon2{background: #32aaeb;}
.hc-icon3{background: #ef3f54;}
.circles li { padding: 10px;}
hr {
height: .25rem;
width: 22%;
margin-left: 12.5%;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
<div class="home-content-1">
<div class="container">
<h1>The Blabla Approach</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam.</p>
<div class="row">
<div class="col span_1_of_4">
<ul class="circles">
<li class="one"><a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3></a></li>
<li class="two"><a href="#"><div class="hc-icon hc-icon1">
</div>
<h3>Demand Generation</h3></a>
</li>
<li class="three">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3></a></li>
<hr />
</ul>
</div>
Please see all my code here -
http://codepen.io/anetk/pen/QyZLNb
Personally, I would do this. I eliminated all the title stuff to isolate what you're trying to do. I substituted your 'hr' element with a 'div'. Changing the div's relative position to the parent container feels a lot safer than changing margins on an 'hr' element that's sized to the body. This responsively sizes the 'highlight' div with the 'li' elements. You can adjust the 'circles' container's margins and widths to your liking.
HTML:
<ul class="circles">
<li class="one">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3>
</a>
</li>
<li class="two">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3></a>
</li>
<li class="three">
<a href="#">
<div class="hc-icon hc-icon1"></div>
<h3>Demand Generation</h3>
</a>
</li>
<div class="highlight"></div>
</ul>
CSS:
body {
font: 300 100% 'Helvetica Neue', Helvetica, Arial;
margin:0;
}
.circles {
display:inline-block;
width:80%;
margin:0 10%;
padding:0;
}
.circles li {
display:inline-block;
list-style-type:none;
text-align:center;
width:33%;
}
.highlight {
position:relative;
left:0;
height:5px;
width:33%;
background: tomato;
transition: .3s ease-in-out;
}
a {
display: inline-block;
width: 100%;
margin: 0;
text-decoration: none;
color: #333;
}
.two:hover ~ .highlight {
left: 33%;
}
.three:hover ~ .highlight {
left: 66%;
}
.circles h3{font-weight: 700;text-transform: uppercase;color: #646464;font-size: 1.3125em;}
.hc-icon{width: 150px;height: 150px;border-radius: 50%;margin: 0px auto 2.25em;}
.hc-icon1{background: #b5d73c;}
.hc-icon2{background: #32aaeb;}
.hc-icon3{background: #ef3f54;}
http://codepen.io/midgitsuu/pen/VeEKgQ
Easiest solution is to put a style on the <hr> to shift it's starting position.
css:
hr {
height: .25rem;
width: 20%;
margin-left: 12.5%;
background: tomato;
border: none;
transition: .3s ease-in-out;
}
The idea is to align the hr with the first circle. You want to use a % and not px so that the align will be responsive with the size of the window.
The change was from margin: 0; to margin-left: 12.5%;

only one link functioning in css only accordion

I am trying to show a CSS only vertical accordion inside a page having other things. Only the accordion is not showing properly - the las / bottom-most link opens the intended text - other links do not. But this same code works when written in a different HTML document having only the accordion.
I have gut feeling that the problem is in the CSS and about sizing or positioning (absolute / relative) - but cannot find it out.
Hope to get some light ...
My HTML and CSS are like below:
HTML:
<html>
<head>
<title>Test page</title>
<link rel="stylesheet" type="text/css" href="main1(with-accordion).css" media="screen">
</head>
<body>
<div id="header">
We do things to help you
<div id="inner_header">
to your satisfaction ....
</div>
</div>
<div id="nav">
<ul>
<li>
<input type="radio" name="tabs" checked id="tab1">
<label for="tab1">Who are we</label>
<div class="content">
<span>
Contents of tab1 goes here:
Visions etc.
</span>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab2">
<label for="tab2">What we do</label>
<div class="content">
<span>Contents of tab2 goes here:
Credentials, visions etc.
</span>
</div>
</li>
<li>
<input type="radio" name="tabs" id="tab3">
<label for="tab3">Contact us</label>
<div class="content">
<span>
Contents of tab3 goes here:
Contents etc.
</span>
</div>
<form method="post" id="data">
<fieldset > <legend> Data </legend>
<br>
<span class="inputs">
<label>First Name :</label>
<input type="text" name="First_Name" size="50">
</span>
<br>
<br>
<span class="inputs">
<label>Middle Name :</label>
<input type="text" name="Middle_Name" size="50">
</span>
<br>
<br>
<span class="inputs">
<label>Last Name :</label>
<input type="text" name="Last_Name" size="50">
</span>
<br>
<br>
<span class="inputs">
<label class="form_label">Address 1 : </label>
<input type="text" name="Address1" size="50">
</span>
<br>
<br>
<span class="inputs">
<label class="form_label">Address 2 :</label>
<input type="text" name="Address2" size="50">
</span>
<br>
<br>
<span class="inputs">
<label class="form_label">Pincode :</label>
<input type="text" name="pincode" size="20">
</span>
<br>
<br>
<span class="inputs">
<label class="form_label">Country :</label>
<select>
<option value="Afghanistan" title="Afghanistan">Afghanistan</option>
<option value="Åland Islands" title="Aland Islands">Aland Islands</option>
<option value="Albania" title="Albania">Albania</option>
<option value="Algeria" title="Algeria">Algeria</option>
<option value="American Samoa" title="American Samoa">American Samoa</option>
<option value="Andorra" title="Andorra">Andorra</option>
<option value="Angola" title="Angola">Angola</option>
<option value="Anguilla"
</select>
</span>
<br>
<br>
<span class="inputs">
<label class="form_label">Email ID :</label>
<input type="email" name="email" size="30">
</span>
<br>
<br>
</fieldset>
</form>
<input class="cancel_button" type="button" name="Cancel" value="Cancel">
<input class="submit_button" type="button" name="Submit" value="Submit">
</li>
</ul>
</div>
<!-- The following code block is the problem area-->
<div id="accordion">
<ul>
<li> Tab1</li>
<div id ="tab1" class="accordion-content">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
</div>
<li> Tab2</li>
<div id ="tab2" class="accordion-content">
Cum eu oporteat voluptatum, mandamus explicari ius eu. Discere
</div>
<li> Tab3</li>
<div id ="tab3" class="accordion-content">
No amet nullam detracto usu, vix posse iracundia deterruisset
</div>
<li> Tab4</li>
<div id ="tab4" class="accordion-content">
In a professional context it often happens that private or
</div>
</ul>
</div>
<!-- The above code block is the problem area-->
<div id="right_bar">Fixed contents here ... </div>
<div id="footer">Page created by: Sukalyan Ghoshal. Email:sukalayn_g#yahoo.com </div>
</body>
</html>
CSS:
#header {
position: absolute;
left: 0;
top: 0;
padding-top: 0;
height: 200px;
line-height: 250%; /**** This line is used to control spacing between the two lines in the header *****/
white-space: nowrap;
text-align: right;
font-size: 3em;
font-style: italic;
font-weight: bold;
color: navy;
width: 100%;
background: -webkit-linear-gradient (to right, mediumblue, darkturquoise);
background: -o-linear-gradient(to right, mediumblue, darkturquoise);
background: -moz-linear-gradient(to right, mediumblue, darkturquoise);
background: linear-gradient(to right, mediumblue, darkturquoise);
}
#inner_header {
display: block;
margin-top: 0;
line-height: 20%; /**** This line is also used to control spacing between the two lines in the header *****/
}
/*accordion css*/
#accordion {
position: absolute;
left: 0;
top: 200px;
}
#accordion ul {
position: relative;
top: 0;
list-style-type: none;
}
#accordion ul a {
display: block;
}
#accordion div {
display: none;
}
#accordion ul li + div:target {
display: inline-block;
margin-top: 10px;
}
.accordion-content {
width: 200px;
}
/* end of accordion css */
#nav {
position: absolute;
left: 225px;
top: 200px;
eight: 600px;
width: 775px;
border-style: solid;
border-width: 1px;
border-color: green;
}
#nav ul {
list-style-type: none;
}
#nav ul li {
display: inline-block; /******* Display property of the li must be set to inline-block along with that of the labels for showing labels side by side *****/
height: 30px;
}
#nav ul li input[type="radio"] {
display: none;
}
#nav ul li label {
float: left;
display:inline-block;
vertical-align: middle;
padding-top: 5px;
padding-bottom: -5px;
margin-bottom: -15px;
width: 125px;
height: 2.1em;
text-align: center;
font-size: 1em;
overflow: auto;
background-color: white;
border-style: solid;
border-width: 1px;
border-color: green;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
border-bottom-width: 0;
line-height: 2.1em;
white-space: nowrap; /****** height=line-height with white-space=nowrap makes text inside an element vertically centered ********/
}
#nav div {
display: none;
position: absolute;
top: 56px;
left: 35px;
width: 700px;
height: 543px;
border-style: solid;
border-width: 1px;
border-color: green;
text-align: center;
}
#nav .content span {
vertical-align: middle;
}
/****** The next two block must be like this to the minimum to show a behaviour of tabs and tabbed content showing not to have a seperation between them ******/
#nav input[type="radio"]:checked ~ div {
display: block;
background-color: pink;
z-index: -1; /****The z-index property of the labels and the <div> element showing tab content must be staggered like this *****/
}
#nav input[type="radio"]:checked ~ label {
border-bottom-width: 0;
height: 2.2em; /*** In this particular design em has been used for height of labels for ease of toggling border between tab and content *****/
background-color: pink;
z-index: 2; /****The z-index property of the labels and the <div> element showing tab content must have staggered z-index like this *****/
}
/****** The previous two block must be like this to the minimum to show a behaviour of tabs and tabbed content showing not to have a seperation between them ******/
#data {
position: absolute;
left: 100px;
top: 100px;
width: 500px;
height: 550px;
display: none;
}
#nav input[id="tab3"]:checked ~ form > fieldset > .inputs {
position: relative;
left: 50px;
width: 100px;
}
#nav input[id="tab3"]:checked ~ form { /**** This styling is required for showing the form. Without this the fields in the form do not show up. *****/
display:inline-block;
}
#nav input[id="tab3"]:checked ~ form > fieldset {
position: absolute;
width: 565px;
left: -10px;
}
#nav input[id="tab3"]:checked ~ form > fieldset > .inputs > label {
display: block;
float: left;
margin: 0;
padding: 3px 13px 0 0;
text-align: right;
width: 140px;
background-color:pink;
border-width: 0;
}
#nav input[id="tab3"]:checked ~ form > fieldset > .inputs > input[type="text"] {
padding-top: -5px;
border:none;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 0 5px #666 inset;
-moz-box-shadow:0 0 5px #666 inset;
box-shadow:0 0 5px #666 inset;
height:25px;
line-height:25px;
width:200px;
text-indent:5px;
}
#nav input[id="tab3"]:checked ~ form > fieldset > .inputs > select {
padding-top: -5px;
border:none;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 0 5px #666 inset;
-moz-box-shadow:0 0 5px #666 inset;
box-shadow:0 0 5px #666 inset;
height:25px;
line-height:25px;
width:200px;
text-indent:5px;
}
#nav input[id="tab3"]:checked ~ form > fieldset > .inputs > input[type="email"] {
padding-top: -5px;
border:none;
-webkit-border-radius:5px;
-moz-border-radius:5px;
border-radius:5px;
-webkit-box-shadow:0 0 5px #666 inset;
-moz-box-shadow:0 0 5px #666 inset;
box-shadow:0 0 5px #666 inset;
height:25px;
line-height:25px;
width:200px;
text-indent:5px;
}
#nav input[id="tab3"]:checked ~ form > fieldset > .inputs > select {
width: 250px;
}
#nav input[id="tab3"]:not(:checked) ~ .cancel_button {
display: none;
}
#nav input[id="tab3"]:not(:checked) ~ .submit_button {
display: none;
}
#nav input[id="tab3"]:checked ~ .cancel_button {
position: absolute;
width: 100px;
left: 400px;
top: 540px;
height: 30px;
border-radius: 5px;
}
#nav input[id="tab3"]:checked ~ .submit_button {
position: absolute;
width: 100px;
left: 550px;
top: 540px;
height: 30px;
border-radius: 5px;
}
#right_bar {
position: absolute;
top: 200px;
left: 1002px;
height: 600px;
width: 340px;
border-style: solid;
border-color: orange;
}
#footer {
position:absolute;
left: 0;
top: 1200px;
width: 100%;
/*border-style: solid;
border-width: 1px;
border-color: black;*/
font-size: 1.25em;
font-style: italic;
font-weight: bold;
text-align: center;
color: white;
background-color: mediumorchid;
height: 100px; /***** The next three lines together vertically center the writing in the <div> ******/
line-height: 100px; /**** height and line-height must be same with white-space having a value of "nowrap" *****/
white-space: nowrap;
background: -webkit-linear-gradient (mediumorchid, violet);
background: -o-linear-gradient(mediumorchid, violet);
background: -moz-linear-gradient(mediumorchid, violet);
background: linear-gradient(mediumorchid, violet);
}
...Sorry for the long HTML and CSS ...
If you set multiple bookmarks with the same ID html never work, remember to set your code well or you'll never find the errors, also have left open many tags, (I've closed myself), click the JSFiddle link below for the correction .
The problem was in this part of code:
HTML
<div id="accordion">
<ul>
<li> Tab1</li>
<div id="tab10" class="accordion-content">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
</div>
<li> Tab2</li>
<div id="tab20" class="accordion-content">
Cum eu oporteat voluptatum, mandamus explicari ius eu. Discere
</div>
<li> Tab3</li>
<div id="tab30" class="accordion-content">
No amet nullam detracto usu, vix posse iracundia deterruisset
</div>
<li> Tab4</li>
<div id="tab40" class="accordion-content">
In a professional context it often happens that private or
</div>
</ul>
</div>
http://jsfiddle.net/Lsbeuv59/4/
I set hashtag with big characters to make sure the resolution of the problem in future cases

Problem with CSS on Wordpress

I'm trying to code my sidebar.php but it breaks and goes all the way down below the posts
PHP:
<!-- begin sidebar -->
<div id="menu">
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<label for="s">SEARCH</label>
<form id="searchform" method="get" action="#">
<div>
<input type="text" name="s" id="s" size="15" />
<br />
<input type="submit" value="TYPE HERE_" />
</div>
</form>
<div class="bg-sidebar">
<h2>MOST READ</h2>
<ul>
<li>Worth A Thousand Words</li>
<li>Feed Your Head</li>
<li>Aliquam tempus, eros commodo porta pretium</li>
<li>Pellentesque quis libero dui</li>
<li>Lorem ipsum dolor sit amet</li>
</ul>
<h2>RECENT POSTS</h2>
<ul>
<li>Worth A Thousand Words</li>
<li>Feed Your Head</li>
<li>Aliquam tempus, eros commodo porta pretium</li>
<li>Pellentesque quis libero dui</li>
<li>Lorem ipsum dolor sit amet</li>
</ul>
<h2>ARCHIVE</h2>
<ul>
<li>
<?php wp_get_archives('type=monthly'); ?>
</li>
</ul>
<h2>LINKS</h2>
<ul>
<li>t</li>
<li>tt</li>
</ul>
</div>
<?php endif; ?>
</div>
CSS:
* { margin: 0; padding: 0; }
body, input { font-family: "Trebuchet MS"; font-size: 12px; }
.move { clear: both; height: 0; float: none !important; }
body { background: url(images/bg.gif); width: 991px; position: absolute; top: 0; left: 50%; margin: 0 0 0 -495px; padding: 0 0 71px 0; }
a { text-decoration: none; }
li { list-style: none; }
img { border: 0; }
#searchform { float: left; width: 366px; height: 27px; }
#searchform * { float: left;}
#searchform label { width:75px; height: 26px; border: solid 1px #ab0000; border-width: 1px 1px 0 0; text-align: center; line-height: 25px; font-weight: bold; font-size: 18px; color: #ab0000; background: white; }
#searchform p { border-bottom: solid 1px #ab0000; width: 290px; height: 25px; }
#searchform input { border: 0; margin: 6px 0 0 10px; display: inline; width: 234px; font-weight: bold; color: #999999; background: transparent; outline: none; height: 16px; }
#searchform button { background: url(images/btn_vai.gif); width: 34px; height: 24px; border: 0; margin: 0 0 2px 0; float: right; }
#menu { width: 366px; height: 40px; float: left; margin: 1px 0 0 0; }
.bg-sidebar { background: white; width: 366px; padding: 50px 0 0 0; }
#menu h2 { color: #ab0000; font-size: 18px; line-height: 18px; padding: 0 0 10px 15px; }
#menu ul { border-top: solid 1px #d5d5d5; padding: 0 0 38px 0; }
#menu li { border-bottom: solid 1px #f3f2f2; line-height: 30px; font-size: 13px; font-weight: bold; padding: 0 0 0 24px; }
#menu li a { color: black; }
Can somebody help me out on this one?
Sidebars that fall below the content in Wordpress are often simply a missing closing </div> tag or two. Use the xhtml code validator at The W3C Markup Validation Service to look at your site and pages. Tick the box to "Show Source" in Options and you'll get a code listing that will point you to which of your theme files have problems. Compare a page with the correct sidebar placement and one that is broken.
Another reason the sidebar might be bumping down is that it's too wide to float-right within the space. I can't tell from the code you supplied but if the full width of the page is set to 966px and the sidebar is 366px, the main area content should be 600px (or less, depending on margins and padding). Try making the sidebar or main body content narrower.
If none of these suggestions work, I recommend posting a link to your page here. You'll get much better answers that way.
I faced the same problem. Once I cut down the body's width and the float element in the widget-area, mine got fixed. Also try to play around with the position elements in the CSS. Mine was fixed after a few tries.

Resources