I just create this div function:
<div class="row">
<div class="col-sm-12">
<!--<img src="images/article_image.png" class="img-responsive" />-->
<?php //echo $wordRow['article_image']; ?>
<h2 class="black_color" style="font-size: 25px; font-style:italic ;margin-left:15px">
<?php echo $wordRow['article_name']; ?>
</h2>
<div class="black_color" style="margin-left:20px; margin-right:20px; overflow-y:auto;">
<?php echo $wordRow['article_description']; ?>
</div>
</div>
</div>
which gives me this white form , which is part of this editor. By that I'm able to create articles on my site. Unfortunalety I get the scrolling on the side if the text is longer. I try do add
overflow-y:auto;
but that doesn't work. Putting a max length for the text doesn't work either. Basicly what I'm trying to do is to put a scrolling inside the white article form and not on the left of the page. Any ideas?
You can set two overflow properties, overflow-x and overflow y
Set the overflow-y to scroll and overflow-x to hidden on the same div and then it'll work just as well
If you give your divs ids and classes you can avoid inline-style and use css stylesheets (a lot easier!)
for example on the outer div you could give id of outer, and the inner div, inner. Your css/style section would look like this (example). Externally linked in stylesheets are preferred/recommended
#outer{height:100%}
#inner{width: 98%;
color:#000000;
overflow-y:scroll;
overflow-x:hidden;
margin-left: 20px;
margin-right:20px;
}
h2{color:#000000;
font-size: 25px;
font-style:italic ;
margin-left:15px}
This helps too:
#outer {
height: 100%
overflow: hidden;
}
#inner {
width: 98.5%;
position: fixed;
overflow:auto;
bottom:23px;
top: 137.5px;
}
<div id="outer">
<div id="inner">
<h2 class="black_color" style="font-size: 25px; font-style:italic ;margin-left:15px"><?php echo $wordRow['article_name']; ?></h2>
<div class="black_color" style="margin-left:20px; margin-right:20px;"><?php echo $wordRow['article_description']; ?></div>
</div>
</div>
Either way is good.
This helped me pretty much.
<div style="height:100%; overflow:hidden">
<div style="width:98.5%; position: fixed; bottom:23px; top: 137.5px; overflow:auto">
<h2 class="black_color" style="font-size: 25px; font-style:italic ;margin-left:15px"><?php echo $wordRow['article_name']; ?>
</h2>
<div class="black_color" style="margin-left:20px; margin-right:20px;">
<?php echo $wordRow['article_description']; ?>
</div>
</div>
</div>
I now get the scrolling inside the form, like this and the whole page stays in place. So will the text stay inside the the white form.
Related
this is my first post here.
I've got a small problem with the website I'm working on at the moment.
Since I'm using a (css) parallax header I wanted to have a "special" footer as well.
The idea was to make it fixed to the bottom and let the body reveal the footer bottom first.
The problem is that my website is made up of multiple segments and the footer is visible in between them.
I tried to fix this by creating a background between the segments like this
.background {
color: #f1f1f1;
width: 100%;
height: 90%;
z-index: -2;
}
my footer looks like this
.footer {
padding: 40px 0;
text-align: center;
text-decoration: none;
background: black;
color: #white;
position: fixed;
bottom: 0;
width: 100%;
z-index: -1;
}
but whichever z-index I try, the footer is either completely in the background or in front of everything.
I don't really know what else I could try.
Here's my (shortend) HTML body (there's only the header and a navbar before that):
<div class="main">
<div class="row">
<div class="leftcolumn">
<div class="card">
<h1><?php echo $welcome1;?></h1>
<h5><?php echo $post;?></h5>
<p><?php echo $welcome2;?></p>
</div>
<div class="card">
<h2>Hiragana</h2>
<h5><?php echo $post;?></h5>
<img src="..//nihongo/pics/hiragana.png" width="650px" height="400px">
<p><?php echo $hira;?></p>
</div>
<div class="card">
<h2>Katakana</h2>
<h5><?php echo $post;?></h5>
<img src="..//nihongo/pics/katakana.png" width="650px" height="400px">
<p><?php echo $kata;?></p>
</div>
</div>
<div class="rightcolumn">
<?php include '../nihongo/php/language.php'; ?>
<div class="card">
<h2><?php echo $me1;?></h2>
<img src="../nihongo/pics/me.png" width="240px" height="322px" style="border: 1px solid black;border-radius:10px;">
<p><?php echo $me2;?></p>
</div>
<div class="card">
<h3><?php echo $use;?></h3>
<div class="fakeimg"><p>Hiragana</p></div><br/>
<div class="fakeimg"><p>Katakana</p></div><br/>
<div class="fakeimg"><p>Kanji</p></div><br/>
</div>
<?php include '../nihongo/php/follow.php';?>
</div>
</div>
</div>
<?php include '../nihongo/php/footer.php';?>
</body>
I'm using all those PHP variables because I'm running this website in multiple languages.
here is a screenshot of the issue without my "fix":
I can provide you more of my code if you want - just tell me what you want to see (I don't want to make this post too long right now).
You could define a white (?) background for .main and add a margin-bottom to .main whose value equals the height of the footer. That way the footer would only become visible after .main is scolled down all the way, in the space that is defined as its margin-bottom.
I am trying to get a little icon on the right bottom corner of the image. So the image gets a little icon on the bottom right cornor of the picture.
<div>
<div class="tab-pane" id="activity">
<div class="post clearfix">
<?php
$suppport = $app->get_supportpage();
foreach($suppport as $support){
?>
<div class="user-block" style="margin-top:5px;">
<img style="margin-top:3%;"class="img-circle" src="/assets/images/profielfotos/64hond.jpg">
<span class="username"><?php echo $support['van_naam'] ?></span>
<span class="description">
<div style=" white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px;">
<b><?php echo $support['bericht']; ?></b><br>
31 minuten geleden<p style="float:right;"><?php echo $support['type']; ?></p></div>
</span>
</div><hr>
<?php } ?>
</div>
</div>
</div>
use div instead of img tags, and use a background-image:url('path') for your images and do a position:absolute on your icon
.image{
width:100px;
height:100px;
position:relative;
background-color:lime;
background-image: url(//www.w3schools.com/Html/pic_trulli.jpg);
background-size: cover;
}
.image .icon i{
position:absolute;
bottom:0px;
right:0px;
font-size: 33px;
color: blue;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="image">
<div class="icon"><i class="fa fa-car"></i></div>
</div>
I would like to insert a link only to the background image of the div and not to the other elements, inserting the inline css !
This is my code:
<div class="col-sm-4 box-home" style="background-image: url('URL-IMAGE');">
<div id="spazio" style="height:55%;"></div>
<div class="description" id="descr-one">
<h2><?php the_field('titolo_il_box'); ?></h2>
<p><?php the_field('descrizione_il_box'); ?></p>
</div>
</div>
I want to add a link to the image of background.
If I add a tag in this mode, link all div !
<a href="URL">
<div class="col-sm-4 box-home" style="background-image: url('URL-IMAGE');">
<div id="spazio" style="height:55%;"></div>
<div class="description" id="descr-one">
<h2><?php the_field('titolo_il_box'); ?></h2>
<p><?php the_field('descrizione_il_box'); ?></p>
</div>
</div>
</a>
You can't add a link to background image only. You can only add links to elements, but not backgrounds.
You could possibly separate the image from background and place the text over it with position: absolute.
.box-home {
position: relative;
max-width: 500px;
display: flex;
align-items: center;
}
img {
max-width: 100%;
width: 100%;
}
.description {
background-color: #000;
color: #fff;
position: absolute;
text-align: center;
width: 100%;
}
<div class="box-home">
<img src="http://res.cloudinary.com/dzw929a4t/image/upload/v1495721050/sample.jpg" alt="" />
<div class="description" id="descr-one">
<h2>title</h2>
<p>description</p>
</div>
</div>
on CodePen: https://codepen.io/Klara/pen/oWVMJz
Note sure if this is what you want to achieve.
This way you target the image only, but I would not recommend separating the title and description from the link target as it might be confusing for the users. From UX perspective it makes more sense to have both the image and the text as one clickable link.
I've been struggling to put some element on an image smoothly and make them responsive, but other tags such as p, h1, a etc. ruins the alignment. I would like to know what could I do?
Source code: fiddle
I would like to achieve something like this:
The problems I'm facing to are:
Text are involving into each other
Texts are overflowing out of the container
PHP:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="slider-space">
<span class="others">
<?php the_post_thumbnail(); ?>
<h1><?php the_title(); ?></h1>
<?php the_excerpt(); ?>
Read More
</span>
</header>
</article>
This code renders following out put:
<article id="post-227" class="post-227 cafes type-cafes status-publish has-post-thumbnail hentry">
<header class="slider-space">
<span class="others">
<img width="618" height="246" src="https://www.flynsarmy.com/wp-content/uploads/2012/09/nivoslider/images/up.jpg" />
<h1>Im just a h1 tag line</h1>
<p>Lorem Ipsum dolor sit amet</p>
Read More
</span>
</header>
</article>
CSS:
.slider-space {position:relative;width: 100%; height: auto; text-align: center; background: rgba(0,0,0,0.4);}
.slider-space img{ width: 100%; height: auto;}
.slider-space span, .slider-space a, .slider-space h1{color: #FFF;}
You should add a wrapper DIV for these elements and give it the following settings, which will place it above its (relatively position) container ( . slider-space) and center it inside that:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
Here is it in your jsfiddle, the wrapper is the .overlay DIV:
https://jsfiddle.net/0Lvvf95c/
Here's the problem:
`http://jsfiddle.net/5gju85un/3/`
I want to prevend div #3 from moving higher while keep float left.
How can I do that?
EDIT
These divs are created by loop in my original code so I can't just make two parent divs.
EDIT
Inserted whole code (I'm making own template to use in wordpress)
HTML/PHP
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post()?>
<div class="produkt ramka">
<div class="produkt_obraz">
<?php woocommerce_show_product_images();?>
</div>
<div class="produkt_nazwa">
<h3 class="produkt_litery"><?php woocommerce_template_single_title();?></h3>
</div>
<div class="produkt_cena">
<?php woocommerce_template_single_price();?>
</div>
<div class="produkt_line">
</div>
<div class="produkt_opis">
<?php the_content();?>
</div>
<div class="produkt_koszyk">
<?php woocommerce_template_loop_add_to_cart()?>
</div>
</div>
<?php endwhile;
}
CSS
.produkt
{
display: inline-block;
height:auto;
min-height:120px;
width:49.50%;
margin-bottom:5px;
background-color:#252525;
overflow:hidden;
}
.produkt:nth-child(2n+1)
{
float:left;
}
.produkt:nth-child(2n)
{
float:right;
}
As you can see the code I've done in jsfiddle is based on this
demo
<div class="divs st">div1</div>
<div class="divs nd">div2</div>
<div style="clear:both"></div>
<div class="divs rd">div3</div>
<div class="divs th">div4</div>
<div class="divs">div5</div>
<div class="divs">div6</div>