I have this site:
link
CODE HTML:
<div class="grid-sizer"></div>
<!-- # ROW-1 # -->
<div class="row">
<div class="grid-item item-1" >
<img src="<?php echo ot_get_option('left1_img'); ?>" />
</div>
<div class="grid-item item-2">
<img src="<?php echo ot_get_option('center1_img'); ?>" />
</div>
<div class="grid-item item-3">
<img src="<?php echo ot_get_option('right1_img'); ?>" />
</div>
</div>
<!-- # ROW-2 # -->
<div class="row">
<div class="grid-item item-2">
<img src="<?php echo ot_get_option('left2_img'); ?>" />
</div>
<div class="grid-item item-1" >
<img src="<?php echo ot_get_option('center2_img'); ?>" />
</div>
<div class="grid-item item-3">
<img src="<?php echo ot_get_option('right2_img'); ?>" />
</div>
</div>
<!-- # ROW-3 # -->
<div class="row">
<div class="grid-item item-small">
<img src="<?php echo ot_get_option('left3_img'); ?>" />
</div>
<div class="grid-item item-medium" >
<img src="<?php echo ot_get_option('center3a_img'); ?>" />
</div>
<div class="grid-item item-small">
<img src="<?php echo ot_get_option('centerb_img'); ?>" />
</div>
<div class="grid-item item-2">
<img src="<?php echo ot_get_option('right3_img'); ?>" />
</div>
</div>
</div>
CODE CSS:
/* ---- grid ---- */
.item-1,.item-3{
width:40%;
}
.grid {
background: #DDD;
}
/* clear fix */
.grid:after {
content: '';
display: block;
clear: both;
}
/* ---- .grid-item ---- */
.item-small{
width: 20% !important;
}
.item-medium{
width: 34% !important;
}
.item-2{
width: 25% !important;
}
.grid-sizer,
.grid-item {
width: 37.333%;
}
.grid-item {
float: left;
}
.grid-item img {
display: block;
width: 100%;
}
I put an image to better understand what they want to do.
The images must have a resolution adjustable height depending on.
I tried to .grid-item img {height:316px;} but the low resolution images do not look good.
What they want is to always have a fixed height equal pictures and look good on all resolutions.
Do you think you can help me to find a solution please?
Thank you in advance!
Because there are several fixed images, you can put them in a single img. In this way you can adjust your image a priori.
Furthermore loading a single img is less expensive than loading several imgs (look on Google "css sprite")
Related
Screenshots:
Inspect element shows:
The "7 in stock" i want to align with the "10" bellow
I would like to align two $elements to display on the same line.
<span class="max">
<?php echo $tickets_sold, $max_tickets; ?>
</span>
When the $tickets_sold is not included, the $max_tickets goes on the top. But when it's included, it immediately goes on the next line.
I've tried many different options as &&, and, but they never appear on the same line. I am sure the solution is easy, but I am a beginner.
$max_tickets = $product->get_max_tickets();
$tickets_sold = wc_get_stock_html( $product );
PHP code
<div class="wcl-progress-meter <?php if($product->is_max_tickets_met()) echo 'full' ?>">
<progress max="<?php echo $max_tickets ?>" value="<?php echo $lottery_participants_count ?>" low="<?php echo $min_tickets ?>"></progress></br>
<span class="zero">0 </span>
<span class="max"> <?php echo $tickets_sold, $max_tickets?></div></span>
</div>
CSS file
.wcl-progress-meter meter::-webkit-meter-suboptimum-value {
box-shadow: 0 5px 5px -5px #999 inset;
background: #cb132b;
display:inline-block;
}
.wcl-progress-meter .zero {
display: inline-block;
position: absolute;
top: -100%;
}
.wcl-progress-meter .min {
display: inline-block;
position: absolute;
top: -100%;
}
.wcl-progress-meter .max {
display: inline-block;
position: absolute;
top: -100%;
right: 0;
vertical-align: middle;
}
Just tweak your HTML a bit and all should work as you desire:
<style>
.flex-parent{display:flex;}
.flex-child{flex-basis:content;margin-right:10px;}
</style>
<div class="max flex-parent">
<div class="flex-child"><?php echo $tickets_sold;?></div>
<div class="flex-child"><?php echo $max_tickets;?></div>
</div>
<style>
.flex-parent{display:flex;}
.flex-child{flex-basis:content;margin-right:10px;}
</style>
<div class="max flex-parent">
<div class="flex-child">tickets_sold</div>
<div class="flex-child">max_tickets</div>
</div>
Or, you could also just use display:inline:
<style>
.inline-block{display:inline-block;margin-right:10px;}
</style>
<div class="max">
<div class="inline-block"><?php echo $tickets_sold;?></div>
<div class="inline-block"><?php echo $max_tickets;?></div>
</div>
<style>
.inline-block{display:inline-block;margin-right:10px;}
</style>
<div class="max">
<div class="inline-block">tickets_sold</div>
<div class="inline-block">max_tickets</div>
</div>
Update:
Note the change to the first example code - I neglected to add the flex-parent class (a className I invented, not a convention) to the .max div.
To center the items in the parent, add justify-content:center; to the parent:
<style>
.flex-parent{display:flex;}
.flex-child{flex-basis:content;margin-right:10px;justify-content:center;}
</style>
<div class="max flex-parent">
<div class="flex-child"><?php echo $tickets_sold;?></div>
<div class="flex-child"><?php echo $max_tickets;?></div>
</div>
Using the display:inline-block method:
<style>
.inline-parent{text-align:center;}
.inline-block{display:inline-block;margin-right:10px;}
</style>
<div class="max inline-parent">
<div class="inline-block"><?php echo $tickets_sold;?></div>
<div class="inline-block"><?php echo $max_tickets;?></div>
</div>
<style>
.inline-parent{text-align:center;}
.inline-block{display:inline-block;margin-right:10px;}
</style>
<div class="max inline-parent">
<div class="inline-block">tickets_sold</div>
<div class="inline-block">max_tickets</div>
</div>
I want to hide the top part of all the image. I tried using clip but that requires the image to be either fixed or absolute. The group of images are of scroll type Is there any way to hide the top part of the image. Below is an example.
<style>
#rightCol{
overflow-x: hidden;
overflow-y: scroll;
max-height: 82vh;
}
body{
overflow:hidden;
}
</style>
<div class="row">
<div class="col-md-9" style="padding:0; border:ridge; " id="rightCol">
<img class="img-responsive" src="<?php echo base_url('assets/images/image_1.jpg') ?>" />
<br>
<img class="img-responsive" src="<?php echo base_url('assets/images/image_2.jpg') ?>" />
<br>
<img class="img-responsive" src="<?php echo base_url('assets/images/image_3.jpg') ?>" />
<br>
<img class="img-responsive" src="<?php echo base_url('assets/images/image_4.jpg') ?>" />
<br>
<img class="img-responsive" src="<?php echo base_url('assets/images/image_5.jpg') ?>" />
<br>
<img class="img-responsive" src="<?php echo base_url('assets/images/image_6.jpg') ?>" />
<br>
</div>
</div>
You can give the .img-responsive a negative margin to cut off the top.
To prevent a visible overlap, you can add some css to the br element.
Example:
#rightCol {
overflow-x: hidden;
overflow-y: scroll;
max-height: 82vh;
}
body {
overflow: hidden;
}
.img-responsive {
margin-top: -100px; /* adjust this to change the amount cropped at top */
display: block;
}
/* acts as spacing between images */
.img-cover {
position: relative;
content: '';
background: white;
height: 5px;
display: block;
}
<div class="row">
<div class="col-md-9" style="padding:0; border:ridge; " id="rightCol">
<img class="img-responsive" src="https://placehold.it/300x300" />
<br class="img-cover">
<img class="img-responsive" src="https://placehold.it/300x300" />
<br class="img-cover">
<img class="img-responsive" src="https://placehold.it/300x300" />
<br class="img-cover">
<img class="img-responsive" src="https://placehold.it/300x300" />
<br class="img-cover">
<img class="img-responsive" src="https://placehold.it/300x300" />
<br class="img-cover">
<img class="img-responsive" src="https://placehold.it/300x300" />
<br class="img-cover">
</div>
</div>
Here's my HTML:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-sm-3">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-add.png'; ?>">
<p>User Add</p>
</div>
<div class="col-sm-3">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-edit.png'; ?>">
<p>User Edit</p>
</div>
<div class="col-sm-3">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-delete.png'; ?>">
<p>User Delete</p>
</div>
</div>
</div>
I'm looking to make the HTML like this:
<a href="#">
<div class="col-sm-3">
....
</div>
</a>
Where when the whole column is a link and when hovered over it changes opacity and is able to redirect to another page. However when i change my HTML my style sheet gets super messed up, and the alignment goes all haywire. (See second Code Pen)
https://codepen.io/JDSWebService/pen/BZpoaq
This is how I want it to look when all is said in done. Three evenly spaced column's with the correct widths.
Heres the Codepen of the issues i'm running into when i change my HTML code
https://codepen.io/JDSWebService/pen/bRgVVz
Help?
You can add 'onclick' instead of messing around with tag since that will screw up the bootstrap's col settings.
For example, <div class="col-sm-3" onclick="location.href='add.user.php';">
Please check out this Codepen. I was not able to test your links, but please let me know if this is what you are looking for.
https://codepen.io/pkshreeman/pen/awpvGy
You can put the a tag inside the col-3 and put all the rest of the content in it. Display the a tag as block, then move the padding code that is on the col-3 to the a tag. You can also move the background and border radius to be on the a tag as well. The col-3 should just be that, columns.
.row {
display: flex;
justify-content: center;
}
.col-sm-3 {
text-align: center;
margin: 0 2.5%;
}
.col-sm-3:hover {
opacity: 0.9;
}
.col-sm-3 a {
font-size: 1.5em;
color: white;
display:block;
padding: 2.5% 25px;
background: #303030;
border-radius: 25px;
}
.col-sm-3 a:hover {
text-decoration: none;
color: #00bc8c;
}
.img-sm {
width: 100px;
height: 100px;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="col-sm-3"><a href="adduser.php">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-add.png'; ?>">
<p>User Add</p></a>
</div>
<div class="col-sm-3"><a href="edituser.php">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-edit.png'; ?>">
<p>User Edit</p></a>
</div>
<div class="col-sm-3"><a href="deleteuser.php">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-delete.png'; ?>">
<p>User Delete</p></a>
</div>
</div>
</div>
I havn't tried this out but I'm pretty sure that one way is to give your link a class like:
<div class="container">
<div class="row">
<a href="adduser.php" class="link">
<div class="col-sm-3">
<img class="img-sm" src="<?php echo Config::get('links/app_root') . 'assets/imgs/icons/user-add.png'; ?>">
<p>User Add</p>
</div>
</a>
and then something like:
.link {
height: 100%;
width: 100%
}
of course from there you can give the .link whatever properties you like. Might not be the best solution, but it is one solution I believe.
This can be easily done with jquery
give class name other than col-sm-3 for each div
make firstcol or col-sm-3 for all cursor: pointer;
$(".firstcol").click(function(){
window.location = "URL";
});
I'm creating a one-page WordPress-theme. In each section there is a header with an image and an overlay.
The header has a background, within there is an image of a wrap-width. on bottom of that, there is a png-image which is semi-transparent and should be full-width, overlaying the header-image.
Since I'm using different styling for the sections, I'm numbering them and the overlay-image is in a different color for each section. So I should insert it through CSS.
Until now I just could make the overlay visible when I type in a height value. But since the page needs to be responsive, I want the height to be variable, and always 100% width.
My Code:
<?php query_posts('post_type=page&order=ASC'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="content" class=" section-<?php echo $i++; ?>">
<h2 class="headline"><?php the_field('headline') ?></h2>
<div class="header">
<div class="wrap cf">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('bones-thumb-600');
}
else {
}
?>
</div>
<div class="overlay"></div>
</div>
<div id="inner-content" class="wrap cf">
<div id="main" class="m-all">
<div class="stripes"></div>
<!-- Thumbnail -->
<a class="logo" href="#top"><img src="<?php echo get_template_directory_uri(); ?>/library/images/logo.png" /></a>
<div class="sidebar">
<?php the_field('sidebar') ?>
</div>
<div class="main-content"><?php the_content(); ?></div>
<img src="<?php echo get_template_directory_uri(); ?>/library/images/separator.svg"/>
</div>
</div>
opacity: 0.5; should be what you search, 0.0 is transparent and 1.0 is visible, so 0.5 would be 50% visible
Please do like this
.image-holder{
height: 200px;
width:200px;
position: relative;
}
.image-holder:after{
content:'';
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background: rgba(0,0,0,.3);
}
<div class="image-holder"><img src="images/img02.jpg" height="371" width="556" alt="image description"></div>
No matter what I tried it doesn't work correctly.
Basically I have a list of images that fill up my entire div's width and height.
Now I just want to add some captions right underneath each images. everything I tried either made the images all verticle in one line, etc.
Any kind of help I can get on this is greatly appreciated!
<div id="index-gallery" style="float:left; padding:5px; margin:10px 0 0 0;">
<? $ires3 = mysql_query("select `id`,`mp4`,`cover` from `d2pxhd`.`videos` WHERE `duration`>'0' AND `active`='1' AND `suspended`='0' AND `add_date`<now() ORDER BY `add_date` DESC limit 24",$db);
while ($img3 = mysql_fetch_assoc($ires3)) { ?>
<a href="/?play=<?=base64_encode(preg_replace('/\s+/', '', $img3['id']));?>&start=1">
<img style="margin:20px 2px;" width="118" height="100" border="0" src="<?=$img3['cover']."002.jpg";?>"></a>
SUBTITLE HERE!!!
<? } ?>
</div>
Try this...
HTML/PHP
<div id="index-gallery">
<?php $ires3 = mysql_query("select `id`,`mp4`,`cover` from `d2pxhd`.`videos` WHERE `duration`>'0' AND `active`='1' AND `suspended`='0' AND `add_date`<now() ORDER BY `add_date` DESC limit 24",$db);
while ($img3 = mysql_fetch_assoc($ires3)) : ?>
<div class="img-box">
<a href="/?play=<?=base64_encode(preg_replace('/\s+/', '', $img3['id']));?>&start=1">
<img style="margin:20px 2px;" width="118" height="100" border="0" src="<?=$img3['cover']."002.jpg";?>">
</a>
<p>SUBTITLE HERE!!!</p>
</div>
<?php endwhile; ?>
<div class="clear-both"></div>
</div>
CSS
#index-gallery {
width:100%;
}
.img-box {
float:left;
padding:5px;
margin:10px 0 0 0;
}
.img-box a, .img-box img {
display:block;
}
.clear-both {
clear:both;
}
Fixed Number of Columns in Each Row (for more consistence formatting)
<?php $cols = 4; ?>
<div id="index-gallery">
<?php $ires3 = mysql_query("select `id`,`mp4`,`cover` from `d2pxhd`.`videos` WHERE `duration`>'0' AND `active`='1' AND `suspended`='0' AND `add_date`<now() ORDER BY `add_date` DESC limit 24",$db); ?>
<?php while ($img3 = mysql_fetch_assoc($ires3)) : ?>
<?php for($i=1; $i <= $cols; $i++) : ?>
<div class="img-box">
<a href="/?play=<?=base64_encode(preg_replace('/\s+/', '', $img3['id']));?>&start=1">
<img style="margin:20px 2px;" width="118" height="100" border="0" src="<?=$img3['cover']."002.jpg";?>">
</a>
<p>SUBTITLE HERE!!!</p>
</div>
<?php if($i == $cols) : ?>
<div class="clear-both"></div>
<?php $i=1; endif; ?>
<?php endfor; ?>
<?php endwhile; ?>
<div class="clear-both"></div>
</div>
Check this out.
JSFIDDLE EXAMPLE
HTML
<div id="index-gallery">
<div class="item">
<img src="http://movingimages.files.wordpress.com/2009/10/earth-simulator-offers-peaks-into-our-planetary-future.jpg?w=780" alt=""/>
<p>My Caption here</p>
</div>
<div class="item">
<img src="http://movingimages.files.wordpress.com/2009/10/earth-simulator-offers-peaks-into-our-planetary-future.jpg?w=780" alt=""/>
<p>My Caption here</p>
</div>
<div class="item">
<img src="http://movingimages.files.wordpress.com/2009/10/earth-simulator-offers-peaks-into-our-planetary-future.jpg?w=780" alt=""/>
<p>My Caption here</p>
</div>
<div class="item">
<img src="http://movingimages.files.wordpress.com/2009/10/earth-simulator-offers-peaks-into-our-planetary-future.jpg?w=780" alt=""/>
<p>My Caption here</p>
</div>
</div>
CSS
.item{
width:200px;
text-align:center;
display:block;
background-color: #ededed;
border: 1px solid black;
margin-right: 10px;
margin-bottom: 10px;
float:left;
}
#index-gallery{
width:465px;
}