div Nesting Isn't Displaying Properly - php

Finally learning HTML5 and CSS, but for some reason I can't get my code displaying properly. Everything shows up the way I want it to except for "topad," which is just not showing up at all. If I remove the id from the div line, it shows up without a problem.
I know my code is probably a mess, but I just want to know why nested divs won't display the way I'm expecting (side by side).
HTML:
<div id="branding" class="clearfix">
<div id="toplogo">
<?php if ( ! is_singular() ) { echo '<h1>'; } ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( get_bloginfo( 'name' ), 'blankslate' ); ?>" rel="home">
<img src="<?php echo esc_url( home_url( '/' ) ); ?>wp-content/themes/smcomics/images/logo.jpg" />
</a>
<?php if ( ! is_singular() ) { echo '</h1>'; } ?>
</div>
<div id="topad">blahblahblah</div>
</div>
CSS:
body {
width: 1000px;
margin-left:auto;
margin-right:auto;
background-color: #ddd;
}
#header {
width: 100%;
margin-left: auto;
margin-right: auto;
background-color: #f9b7d3
}
#branding {
width: 100%;
margin-left: auto;
margin-right: auto;
background-color: #a1b2c3;
}
#toplogo {
width: 237;
height: 100;
float: left;
}
#topad {
width: 728;
height: 90;
float: right;
background-color: #023452;
}
.clearfix:after {content:"."; display:block; height:0; clear:both; visibility:hidden;}
.clearfix {display:inline-block;}
/* Hide from IE Mac \*/
.clearfix {display:block;}

You missed to write PX in your css for id's toplogo and topad
#toplogo {
width: 237px;
height: 100px;
float: left;
}
#topad {
width: 728px;
height: 90px;
float: right;
background-color: #023452;
}

Related

Play button over thumbnail with CSS

I'm trying to display play button over a thumbnail with CSS in my WordPress. I tried many methods but always is bad. Can you help me, where I am wrong?
.post-thumbnail-sidebar {
display: block;
text-align: center;
}
.post-thumbnail-sidebar embed,
.post-thumbnail-sidebar iframe,
.post-thumbnail-sidebar object {
margin-bottom: 30px;
}
.post-thumbnail-sidebar a {
position: absolute;
display: block;
background: url("https://i.imgur.com/FPwyRnP.png") no-repeat;
height: 85px;
width: 136px;
top: 100%;
left: 100%;
margin: -64px 0 0 -88px;
}
<a class="post-thumbnail-sidebar" href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( $r_post_thumb_size, array( 'itemprop' => 'image' ) ); ?>
</a>
Not enough but i think you can start with this.
here's a fiddle
.second-img {
position: absolute;
top: 0px;
margin-left: 20px
}
<div>
<img class="background-img" width="100%" height="100%" style="position:absolute; top:0; left:0;" src= "https://vincentloy.files.wordpress.com/2012/01/in-time-2011-r5-line-xvid-fusion_screenshot_4.jpg">
<img class="second-img" width="100%" height="100%" src = "http://sanyangfrp.com/data/out/805/511806414-play-button-png.png" />
</div>

how do i remove white spaces in between these images in bootstrap 3

Good day,
Am in the process of building a free wordpress theme for entrepreneurs but encountered this challenges:
I want to get rid of white spaces in between the post containers as show in the image above.
in the posts in between, the post dates are not displaying, i don't know why.
here are my code:
HTML/PHP
<div class="container-fluid">
<div class="navbar">
<div>
<a class="navbar-brand" href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>" >
<?php bloginfo('name'); ?></a>
</div>
<div>
<!--<h1 class="blog-title"><?php bloginfo( 'name' ); ?></h1>-->
<?php $description = get_bloginfo( 'description', 'display' ); ?>
<?php if($description) { ?><p class="blog-description"><?php echo $description ?></p><?php } ?></p>
<?php wp_nav_menu (array(
'theme_location' => 'header-menu',
'menu_class' => 'nav navbar-nav pull-right'
) ); ?>
</div>
CSS:
.layerit {
width: 100%;
height: 100%;
padding-top: 170px;
margin: 0 auto;
background: rgba(0, 0, 0, .3);
position: relative;
bottom: 0;
right: 0;
text-align: center;
transition: background-color .9s ease;
}
.home-title {
color: white;
}
.home-author {
color: white;
padding-top: 20px;
padding-bottom: 90px;
}
div.no-margin {
}
Thanks for the help.
For vertical lines:
font-size: 0; on parent element
OR
ul {
padding: 0;
}
li{
display: inline-block;
background: red;
width: 20px;
height: 20px;
}
<ul>
<li></li>
<li></li>
</ul>
SHOULD BE
ul {
padding: 0;
}
li{
display: inline-block;
background: red;
width: 20px;
height: 20px;
}
<ul>
<li></li><li></li>
</ul>
For horizontal lines:
vertical-align: top; for child elements
EDIT: Putting all <li> tags in a single line removes the whitespace in the markup, which is what's causing the spaces in the original question. Another more manageable way to fix it is to use html comments between the closing tag and the next opening one, like this:
<li>...</li><!--
--><li>...</li><!--
--><li>...</li>

Centring logo on Wordpress template

I'm having a nightmare trying to center a logo in the header on a WP template. Can anyone please work out the following code and center the logo?
CSS
/**
* Header
* --------------------------------------------------------------------------- */
#header {
padding-top: 3em;
margin-bottom: 2.5em; }
#header #branding {
*zoom: 1;
max-width: 80%;
display: inline-block;
text-align: left; }
#header #branding:before, #header #branding:after {
content: " ";
display: table; }
#header #branding:after {
clear: both; }
#header #site-title {
display: inline-block;
margin: 0;
font-size: 2.25em;
text-align: left; }
#header #site-title a {
display: inline-block;
text-align: inherit; }
#header #site-title img {
display: block;
text-align: inherit;
margin: 0 auto;
vertical-align: baseline; }
#header.with-woocommerce #branding {
max-width: 100%;
display: block;
text-align: center;
margin-bottom: 2em; }
#header.with-woocommerce #site-title {
text-align: center; }
#header.with-woocommerce #site-title a {
display: block; }
PHP
<header id="header" class="<?php echo $hclass; ?>">
<hgroup id="branding">
<h1 id="site-title" role="logo">
<a href="<?php echo trailingslashit( esc_url( home_url() ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>">
<?php if ( get_theme_mod( 'bearded_logo' ) ) : ?>
<img src="<?php echo esc_url( get_theme_mod( 'bearded_logo' ) ); ?>" alt="<?php bloginfo( 'name' ); ?>" />
<?php else : bloginfo( 'name' ); endif; ?>
</a>
</h1>
<h2 id="site-description" class="hide-for-small"><?php bloginfo( 'description' ); ?></h2>
</hgroup><!-- #branding -->
<hgroup id="navigation" role="navigation" >
<?php do_atomic( 'before_nav' ); ?>
<?php get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?>
<?php do_atomic( 'after_nav' ); ?>
</hgroup>
</header><!-- #header -->
Please help. Thank you - any advice would be much appreciated!
Add to CSS:
#site-title img {
margin-left: 45%;
}
Based off your more recent changes to the site you can add this to center the logo
#header #branding, #header.with-woocommerce #branding {
display: table;
margin: 0 auto;
}
If you go back to where the shop-nav is not full width I would make the header position relative and absolute position the shop-nav top right 0.
Give id="site-title" a margin-left: 43%

CSS background image not displaying (path of image is correct)

I am trying to add background image to div. For some reason I can't add picture. Can you guys tell me what I am doing wrong?
Here is code:
#featured {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: #ffffff;
background: url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg');
background-repeat: no-repeat;
border: 1px solid #e5e5e5;
border-radius: 40px;
padding-bottom: 40px;
width: 99.893617021277%;
}
#featured p {
font-size: 18px;
font-weight: 200;
line-height: 27px;
padding: 0 40px 0 40px;
text-align: center;
}
#featured-image {
margin: 40px 0 0 0;
}
#featured-image .fluid-width-video-wrapper {
margin-left: -20px;
}
.featured-image img {
margin-top: 44px;
}
Here is HTML/PHP part. It's a custom wordpress theme and I will only show you exact part of website where this DIV is used.
<div id="featured" class="grid col-940">
<div class="grid col-460">
<h1 class="featured-title">
<?php
if ( isset( $responsive_options['home_headline'] ) && $db && $empty )
echo $responsive_options['home_headline'];
else
_e( 'Hello, World!', 'responsive' );
?>
</h1>
<h2 class="featured-subtitle">
<?php
if ( isset( $responsive_options['home_subheadline'] ) && $db && $empty )
echo $responsive_options['home_subheadline'];
else
_e( 'Your H2 subheadline here', 'responsive' );
?>
</h2>
<p>
<?php
if ( isset( $responsive_options['home_content_area'] ) && $db && $empty )
echo do_shortcode( $responsive_options['home_content_area'] );
else
_e( 'Your title, subtitle and this very content is editable from Theme Option. Call to Action button and its destination link as well. Image on your right can be an image or even YouTube video if you like.','responsive' );
?>
</p>
<?php if ($responsive_options['cta_button'] == 0): ?>
<div class="call-to-action">
<a href="<?php echo $responsive_options['cta_url']; ?>" class="blue button">
<?php
if( isset( $responsive_options['cta_text'] ) && $db && $empty )
echo $responsive_options['cta_text'];
else
_e('Call to Action','responsive');
?>
</a>
</div><!-- end of .call-to-action -->
<?php endif; ?>
</div><!-- end of .col-460 -->
<div id="featured-image" class="grid col-460 fit">
<?php $featured_content = ( !empty( $responsive_options['featured_content'] ) ) ? $responsive_options['featured_content'] : '<img class="aligncenter" src="' . get_template_directory_uri() . '/core/images/featured-image.png" width="440" height="300" alt="" />'; ?>
<?php echo do_shortcode( $featured_content ); ?>
</div><!-- end of #featured-image -->
</div><!-- end of #featured -->
EDIT 2: Added HTML output:
http://pastebin.com/T78ZPQZK
change this
#featured {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: #ffffff;
background: url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg');
background-repeat: no-repeat;
border: 1px solid #e5e5e5;
border-radius: 40px;
padding-bottom: 40px;
width: 99.893617021277%;
}
to this
#featured {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background: #fff url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg') no-repeat;
border: 1px solid #e5e5e5;
border-radius: 40px;
padding-bottom: 40px;
width: 99.893617021277%;
}
or to this
#featured {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: #ffffff;
background-image: url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg');
background-repeat: no-repeat;
border: 1px solid #e5e5e5;
border-radius: 40px;
padding-bottom: 40px;
width: 99.893617021277%;
}
Give this a shot, with what you provided should work, just try adding a height value and background-size to the #featured div...also, somewhere along the lines in your html you have a php error...
HTML:
<div id="featured" class="grid col-940">
<div class="grid col-460">
<h1 class="featured-title">
<?php
if ( isset( $responsive_options['home_headline'] ) && $db && $empty )
echo $responsive_options['home_headline'];
else
_e( 'Hello, World!', 'responsive' );
?>
</h1>
<h2 class="featured-subtitle">
<?php
if ( isset( $responsive_options['home_subheadline'] ) && $db && $empty )
echo $responsive_options['home_subheadline'];
else
_e( 'Your H2 subheadline here', 'responsive' );
?>
</h2>
<p>
<?php
if ( isset( $responsive_options['home_content_area'] ) && $db && $empty )
echo do_shortcode( $responsive_options['home_content_area'] );
else
_e( 'Your title, subtitle and this very content is editable from Theme Option. Call to Action button and its destination link as well. Image on your right can be an image or even YouTube video if you like.','responsive' );
?>
</p>
<?php if ($responsive_options['cta_button'] == 0): ?>
<div class="call-to-action">
<a href="<?php echo $responsive_options['cta_url']; ?>" class="blue button">
<?php
if( isset( $responsive_options['cta_text'] ) && $db && $empty )
echo $responsive_options['cta_text'];
else
_e('Call to Action','responsive');
?>
</a>
</div><!-- end of .call-to-action -->
<?php endif; ?>
</div><!-- end of .col-460 -->
<div id="featured-image" class="grid col-460 fit">
<?php $featured_content = ( !empty( $responsive_options['featured_content'] ) ) ? $responsive_options['featured_content'] : '<img class="aligncenter" src="' . get_template_directory_uri() . '/core/images/featured-image.png" width="440" height="300" alt="" />'; ?>
<?php echo do_shortcode( $featured_content ); ?>
</div><!-- end of #featured-image -->
</div><!-- end of #featured -->
CSS:
#featured {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
background-color: #ffffff;
background: url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg') no-repeat 0 0;
-moz-background-size: cover;
-webkit-background-size: cover;
background-size: cover;
border: 1px solid #e5e5e5;
border-radius: 40px;
padding-bottom: 40px;
width: 99.893617021277%;
height: 500px; /*-- Specify to your liking --*/
}
#featured p {
font-size: 18px;
font-weight: 200;
line-height: 27px;
padding: 0 40px 0 40px;
text-align: center;
}
#featured-image {
margin: 40px 0 0 0;
}
#featured-image .fluid-width-video-wrapper {
margin-left: -20px;
}
.featured-image img {
margin-top: 44px;
}
UPDATE / EDIT:
Better yet, take a look at this jsfiddle: http://jsfiddle.net/M63EG/1/
Updated code provided above!
Maybe, you need the !important key. So, in #featured CSS class, write this:
background: url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg') !important;
in place of:
background: url('http://www.mobiexplore.com/temp1/wordpress/wp-content/uploads/2013/08/19377249_ml-1024x6651.jpg');

jcarousel is not scrolling through images

i have a jcarousel gallery of images
but the jcarousel is not working at all it's not scrolling through images at all
this is my code :
<ul id="mycarousel" class="jcarousel-skin-tango">
<?php foreach ($images as $image_item) : ?>
<li><img src="<?php echo $image_item['Path']; ?>"/></li>
<?php endforeach; ?>
</ul>
and this is my css :
.jcarousel-skin-tango .jcarousel-container {
width:500px;
height:250px;
background: none;
border: none;
}
.jcarousel-skin-tango .jcarousel-container-horizontal {
height:250px;
padding: 20px 40px;
}
.jcarousel-skin-tango .jcarousel-clip-horizontal {
width: 500px;
height: 250px;
}
.jcarousel-skin-tango .jcarousel-item {
width: 500px;
height: 250px;
}
.jcarousel-skin-tango .jcarousel-item-horizontal {
margin-left: 0;
margin-right: 10px;
}
and there is my js :
$(document).ready(function(){
$('#mycarousel').jcarousel({wrap:'circular'});
});
Your code is almost correct — you just need to add "auto: 1" (or some other non-zero number of seconds) and it'll start auto-scrolling. If you don't want auto-scroll, you need to specify the "buttonNextHTML" and "buttonPrevHTML" parameters to get buttons.

Categories