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;
}
Related
I have two pages with search results from the Search & Filter plugin, as i don't know how to build the query and loop myself.
http://staging.montra.dk/tilbud & http://staging.montra.dk/events
I want the results to look just like my blocks on the rest of the site; image on one side - text on the other, and then reverse that in the next row. I've successfully managed to display this on every other page than the Search & Filter pages. It's either all images on the left or right, not reversing every other.
I've targeted the div id #artikel on the working pages, but that won't work. Do i need to use some kind of unique id here?
This is my css from the results php;
<section id="post-<? the_ID(); ?>" <? post_class('blok-item'); ?>>
<div class="container-wrap">
<div class="container">
<div id="search-blok" class="row">
<div id="artikel">
<div id="artikel-image" class="col-sm-12 col-md-12 col-lg-6" style="background:linear-gradient( rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.1)), url(<?php the_field( 'intro_billede' ); ?>); background-position: 0% 50%; background-size: cover;"></div>
<div id="artikel-content" class="col-sm-12 col-md-12 col-lg-6">
<div class="hotel-name-artikel">
<?php the_field( 'intro_lille_overskrift' ); ?>
</div>
<div class="artikel-overskrift">
<h2><?php the_title(); ?></h2>
</div>
<div class="artikel-intro">
<?php the_field( 'intro_tekst' ); ?>
</div>
<?php if ( get_field( 'intro_pris' ) ): ?>
<div class="pris-wrapper">
<h2 class="pris">KR. <?php the_field( 'intro_pris' ); ?>,-</h2>
<h4 class="pris-ekstra"><?php the_field( 'intro_pris_extra' ); ?></h4>
</div>
<?php endif ?>
<div class="artikel-link-container">
<?php if ( have_rows( 'links_repeater' ) ) : ?>
<?php while ( have_rows( 'links_repeater' ) ) : the_row(); ?>
<?php $side_intro_repeater_knap_url = get_sub_field( 'side_intro_repeater_knap_url' ); ?>
<?php if ( $side_intro_repeater_knap_url ) { ?>
<a class="<?php the_sub_field( 'repeater_knap_farve' ); ?>" style="float:left" href="<?php echo $side_intro_repeater_knap_url; ?>"><?php the_sub_field( 'repeater_knap_tekst' ); ?></a>
<?php } ?>
<?php endwhile; ?>
<?php else : ?>
<?php // no rows found ?>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
and the :nth-child css:
artikel:nth-last-child(odd) {
display: -webkit-flex; /* Safari */
-webkit-flex-direction: row-reverse; /* Safari 6.1+ */
display: flex;
flex-direction: row-reverse;
flex-wrap: wrap;
}
Now i'm no wiz at php nor css, so the code might not be precisely as it ought to be, so please bare that in mind :)
Thanks for all help and assistance
I want the results to look just like my blocks on the rest of the
site; image on one side - text on the other, and then reverse that in
the next row.
I'm not entirely sure I understand the question, but if I do, you are definitely on the right track using flex-direction: row and flex-direction: row-reverse.
Working Example:
article {
display: flex;
flex-direction: row;
justify-content: space-between;
width: 600px;
}
article:nth-of-type(even) {
flex-direction: row-reverse;
}
.text-block,
.image-block {
flex: 1 1 50%;
}
img {
display: block;
width: 90%;
height: 150px;
margin-top: 30px;
line-height: 150px;
text-align: center;
border: 1px solid rgb(0, 0, 0);
}
<main>
<article>
<div class="text-block">
<h2>Heading</h2>
<p>Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph.</p>
</div>
<div class="image-block">
<img src="" alt="Image" />
</div>
</article>
<article>
<div class="text-block">
<h2>Heading</h2>
<p>Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph.</p>
</div>
<div class="image-block">
<img src="" alt="Image" />
</div>
</article>
<article>
<div class="text-block">
<h2>Heading</h2>
<p>Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph.</p>
</div>
<div class="image-block">
<img src="" alt="Image" />
</div>
</article>
<article>
<div class="text-block">
<h2>Heading</h2>
<p>Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph.</p>
</div>
<div class="image-block">
<img src="" alt="Image" />
</div>
</article>
</main>
This is the container and two sections which i'd like to display flex; one with the image on the left and text on the right. The next row text on the left, image on the right.
This is the container and two sections which i'd like to display flex; one with the image on the left and text on the right. The next row text on the left, image on the right.
<div class="search-filter-results" id="search-filter-results-2898">
<div class="container" style="background-color:#21002c;color:#fff;">
<div class="search-results"><h6>Viser 24 resultater</h6></div>
</div>
<div class="pagination">
<div class="nav-previous"><a href="http://staging.montra.dk/tilbud?sf_paged=2" >Ældre indlæg</a></div>
<div class="nav-next"></div>
</div>
<section id="post-3293" class="blok-item post-3293 odderparkhotel type-odderparkhotel status-publish kategori-tilbud hoteller-odder-parkhotel">
<div class="container-wrap">
<div class="container">
<div id="search-blok" class="row">
<div class="artikel">
<div class="artikel-image col-sm-12 col-md-12 col-lg-6" style="background:linear-gradient( rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.1)), url(http://staging.montra.dk/wp-content/uploads/2020/01/Weekend-intro.jpg); background-position: 0% 50%; background-size: cover;"></div>
<div class="artikel-content col-sm-12 col-md-12 col-lg-6">
<div class="hotel-name-artikel">
</div>
<div class="artikel-overskrift">
<h2>Weekendphold for 2 i Jylland</h2>
</div>
<div class="artikel-intro">
<p>Nyd et weekendophold for 2 på 4-stjernet hotel i Odder syd for Århus med velrenommeret køkken, som byder på udsøgte smagsoplevelser.</p>
</div>
<div class="pris-wrapper">
<h2 class="pris">KR. 995,-</h2>
<h4 class="pris-ekstra"></h4>
</div>
<div class="artikel-link-container">
<a class="knap-1" style="float:left" href="http://staging.montra.dk/odder-parkhotel/weekendphold-for-2-i-jylland">Læs mere</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="post-3290" class="blok-item post-3290 odderparkhotel type-odderparkhotel status-publish kategori-tilbud hoteller-odder-parkhotel">
<div class="container-wrap">
<div class="container">
<div id="search-blok" class="row">
<div class="artikel">
<div class="artikel-image col-sm-12 col-md-12 col-lg-6" style="background:linear-gradient( rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.1)), url(http://staging.montra.dk/wp-content/uploads/2020/01/Aarhus-intro.jpg); background-position: 0% 50%; background-size: cover;"></div>
<div class="artikel-content col-sm-12 col-md-12 col-lg-6">
<div class="hotel-name-artikel">
Montra Odderpark Hotel </div>
<div class="artikel-overskrift">
<h2>Mangler du også en studiebolig til studiestart 2020</h2>
</div>
<div class="artikel-intro">
<p>I Århus er der mangel på studieboliger og derfor vil vi på Montro Odder Parkhotel gerne hjælpe studerende, som er i akut boligmangel.</p>
</div>
<div class="pris-wrapper">
<h2 class="pris">KR. 2.000,-</h2>
<h4 class="pris-ekstra"></h4>
</div>
<div class="artikel-link-container">
<a class="knap-1" style="float:left" href="http://staging.montra.dk/odder-parkhotel/mangler-du-ogsaa-en-studiebolig">Læs mere</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
my 'about me' and echoed 'about text' appear below the containing div(class="u-about"), for both of them, i have no idea why its doing this, and id rather not use relative positioning to move it up, as it seems messy, and it shouldn't be doing this in the first place. any idea's on how to fix this would be much appreciated!
my css code:
.profile-about { /* contains profile card and about card */
float: left;
}
.u-about {
position: relative;
top: 100px;
display: block;
width: 400px;
height: 220px;
background-color: white;
border-radius: 10px;
text-align: center;
margin: 0px;
}
.ubout {
margin: 0px;
}
my html code:
<section>
<div>
<div class="profile-about">
<div class="u-profile-card">
<h3>Guide:</h3>
<div>
<h2><?php echo ucfirst($first);?> <?php echo $last; ?></h2>
</div>
<div class="img-txt">
<div class="image-cropper">
<img class="u-image" src="uploads/<?php echo $image; ?>" alt="no
image found">
</div>
<div class="u-info">
<h2><?php echo ucfirst($u_city); ?>, <?php echo ucfirst($u_region); ?
>, <?php echo ucfirst($u_country); ?></h2>
<h2><?php echo ucfirst($u_rating); ?> Stars</h2>
<h2 class="u-email"><?php echo ucfirst($email); ?></h2>
</div>
</div>
</div>
<div class="u-about">
<div>
<h1>About me</h1>
<p class="ubout"><?php echo ucfirst($about); ?></p>
</div>
</div>
</div>
By the containing div, I assume you mean their direct parent <div class="u-about">. The elements do not actually appear below that... though they may well appear to, due to the fact that you have top: 100px on this element. Simply removing this will bring the entire .u-about element up the page, including both texts:
.profile-about {
/* contains profile card and about card */
float: left;
}
.u-about {
position: relative;
/*top: 100px;*/
display: block;
width: 400px;
height: 220px;
background-color: white;
border-radius: 10px;
text-align: center;
margin: 0px;
}
.ubout {
margin: 0px;
position: relative;
bottom: 200px;
}
<section>
<div>
<div class="profile-about">
<div class="u-profile-card">
<h3>Guide:</h3>
<div>
<h2>
<?php echo ucfirst($first);?>
<?php echo $last; ?>
</h2>
</div>
<div class="img-txt">
<div class="image-cropper">
<img class="u-image" src="uploads/<?php echo $image; ?>" alt="no
image found">
</div>
<div class="u-info">
<h2>
<?php echo ucfirst($u_city); ?>,
<?php echo ucfirst($u_region); ?
>, <?php echo ucfirst($u_country); ?>
</h2>
<h2>
<?php echo ucfirst($u_rating); ?> Stars</h2>
<h2 class="u-email">
<?php echo ucfirst($email); ?>
</h2>
</div>
</div>
</div>
<div class="u-about">
<div>
<h1>About me</h1>
<p class="ubout">
<?php echo ucfirst($about); ?>
</p>
</div>
</div>
</div>
</div>
</section>
Try this:-
.profile-about { /* contains profile card and about card */
float: left;
}
.u-about {
position: relative;
display: block;
top:100px;
width: 400px;
height: 220px;
background-color: white;
border-radius: 10px;
text-align: center;
margin: 0px;
}
.ubout {
margin: 0px;
position: relative;
bottom: 200px;
}
.child{
position: absolute;
height: 320pxpx;
margin: -100px 0 0 0px;
}
<section>
<div>
<div class="profile-about">
<div class="u-profile-card">
<h3>Guide:</h3>
<div>
<h2><?php echo ucfirst($first);?> <?php echo $last; ?></h2>
</div>
<div class="img-txt">
<div class="image-cropper">
<img class="u-image" src="uploads/<?php echo $image; ?>" alt="no
image found">
</div>
<div class="u-info">
<h2><?php echo ucfirst($u_city); ?>, <?php echo ucfirst($u_region); ?
>, <?php echo ucfirst($u_country); ?></h2>
<h2><?php echo ucfirst($u_rating); ?> Stars</h2>
<h2 class="u-email"><?php echo ucfirst($email); ?></h2>
</div>
</div>
</div>
<div class="u-about" style="background-color:red;">
<div class="child">
<h1>About me</h1>
<p class="ubout"><?php echo ucfirst($about); ?></p>
</div>
</div>
</div>
I am making a invoice generate web application. invoice is design with div, and row & cell are also border lined div.
All is good in the screen but when i send invoice to print, all the bottom border line are stack up in first page which are to be in second page, weird part is this only happens in second page only.
How can I fix this??
Here is HTML code for each row this keep looping for max number of rows needed.
<div class="container_24">
<div id="invoice_frame" class="grid_18" style="padding:0px;">
<?php for ($x = 1; $x <= 60; $x++) {
<!-- Row Box <?php echo $x ?> -->
<div class="rowBox rowBox-<?php echo $x ?> ti_box_WO_bottom" data-id="1" style="width:705px;">
<div class="ti_box_onlyRight"> </div>
<div class="ti_box_onlyRight"> </div>
<div class="ti_box_onlyRight" style="width:378px;" align="left"> </div>
<div class="ti_box_onlyRight"> </div>
<div style="margin:0px; margin-right:3px;"> </div>
</div>
<?php } ?>
<div class="ti_line"> </div>
<div>
<div style="width:592px;" align="right"><strong>Total: </strong></div>
<div class="ti_box" style="width:113px;" align="center"><?php echo $TInvoice_ROW['total_amount']; ?></div>
</div>
<div>
<div style="width:592px;" align="right"><strong>Tax(GST) 6%: </strong></div>
<div class="ti_box" style="width:113px;" align="center"><?php echo $TInvoice_ROW['gst_amount']; ?></div>
</div>
<div>
<div style="width:592px;" align="right"><strong>Grand Total: </strong></div>
<div class="ti_box pv_total_box" style="width:113px; margin:0px;"><?php echo $TInvoice_ROW['total_grand']; ?></div>
</div>
<div>
<div style="padding-top:6px;" align="right"><strong>Amount in words: </strong></div>
<div style="width:559px; vertical-align:text-bottom; margin:0px;" align="left">
<textarea name="inwords" disabled="disabled" readonly class="pv_textbox_WO_outline" id="inwords" style="width:580px;"></textarea>
</div>
</div>
</div>
</div>
Here is CSS
.container_24 {
margin-left: auto;
margin-right: auto;
width: 960px;
}
#invoice_frame {
margin: 5px;
background-color: #FFF;
padding: 20px;
}
#invoice_frame div{
display: inline-block;
float: left;
}
#invoice_frame div.ti_box_onlyRight {
border-right-width: 1px;
border-right-style: solid;
border-right-color: #000;
margin:0px !important;
}
#invoice_frame div.ti_box_WO_bottom {
border: 1px solid #000;
border-bottom: none !important;
}
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")
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>