<div class="past-page"><?php previous_posts_link( '« Previous Page' ); ?></div>
Hello! I'm having a bit of troubles trying to solve the styling of a pagination button. I tried styling the past-page div, but that made a white box show up when no link was there... which was not the result I wanted.
So, I'm wondering if I can somehow add styling in the php tag here?
The style I want to add is
font-size: 10pt;
text-transform: uppercase;
font-weight: bold;
background: #fff;
padding: 10px;
use :not(:empty) to add style to a div that is 'not empty'; otherwise, when it is blank, it reverts back to the default CSS:
<style>
.past-page:not(:empty) {
font-size: 10pt;
text-transform: uppercase;
font-weight: bold;
background: #fff;
padding: 10px;
}
</style>
Alternatively, you could apply the style always unless empty then make it invisible:
<style>
.past-page {
font-size: 10pt;
text-transform: uppercase;
font-weight: bold;
background: #fff;
padding: 10px;
}
.past-page:empty {
display: none !important;
}
</style>
Related
This question already has answers here:
Make a div into a link
(30 answers)
Closed 2 years ago.
I am trying to get my whole div a clickable link but I am not sure the correct way to do it. Would anyone be able to help me with this, it would be greatly appreciated. I am new to coding so I am still learning proper coding. Thanks.
.container {
display: flex;
margin: auto;
width: 1052px;
}
.container>div {
background-color: #ffffff;
border: 1px solid #aaaaaa;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
flex: 1;
/*grow*/
height: 210px;
margin: 45px 10px 0px 10px;
width: 231px;
}
.container img {
height: 140px;
width: 241px;
}
.container>div a {
color: #353748;
display: block;
font-family: Netflix Sans, Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 20px;
padding: 5px 10px 5px 10px;
text-decoration: none;
text-overflow: ellipsis;
text-transform: initial;
}
.container>div a:hover {
color: #353748;
display: block;
font-family: Netflix Sans, Helvetica, Arial, sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 20px;
padding: 5px 10px 5px 10px;
text-decoration: underline;
text-overflow: ellipsis;
text-transform: initial;
}
<div class="container">
<div>
<img src="https://capebretonstartpage.com/1/wire-31023566-1595346165-638_636x382.jpg">
About vAdd An Image Add An Image
</div>
<div>
<img src="https://capebretonstartpage.com/1/wire-31023566-1595346165-638_636x382.jpg">
About vAdd An Image Add An Image
</div>
<div>
<img src="https://capebretonstartpage.com/1/wire-31023566-1595346165-638_636x382.jpg">
About vAdd An Image Add An Image
</div>
</div>
You can put the div inside an <a> tag
Google keeps giving me results based on fixing my phone, but the problem is on my website. This is a weird problem, but on a mobile device on my website, I can't click any buttons or links. desktop works fine, but mobile is having issues. I'm making this site directly on cpanel, so I don't know if there is some special code I need to add to detect mobile taps, I usually use wordpress, so I don't know a whole lot about making a website directly on mysqli. The mobile taps will work outside a container, but I need it to work inside my page container. its inside a <div> and a <pre>. I don't really understand the problem, here is what some of my code looks like:
Global Styles:
pre{
border: solid 3px #2b333d;
border-radius: 10px;
font-size: 15px;
color: #3c3d3c;
margin: 1%;
padding: 10px;
background: #eaeaea;
display: block;
font-family: monospace;
white-space: pre-wrap;
}
input{
border: solid 2px #2b333d;
border-radius: 10px;
font-size: 15px;
color: #3c3d3c;
margin: 1%;
padding: 8px;
background: #f7f7f7;
font-family: Arial, Helvetica, sans-serif;
white-space: pre-wrap;
outline: none;
display: inline-block;
}
input[type=button], input[type=submit], input[type=reset]{
border: solid 2px #142135;
border-radius: 10px;
font-size: 18px;
color: #f7f7f7;
margin: 1%;
padding: 5px 7px;
background: #5791ed;
font-family: Arial, Helvetica, sans-serif;
white-space: pre-wrap;
outline: none;
letter-spacing: 0;
display: inline-block;
}
form{
line-height: 0.2;
white-space: normal;
}
Page/Header Styles:
.page_m{
background: #fcfcfc;
width: 99.9%;
left: 0.1%;
z-index: -20;
top: 30px;
position: relative;
}
.page_inner_m{
padding: 20px;
z-index: -20;
position: relative;
font-family: Arial, Helvetica, sans-serif;
white-space: pre-wrap;
color: #2d2d2d;
letter-spacing: 0.5;
line-height: 1.55;
border: 0;
border-radius: 0;
font-size: 18px;
margin: 0;
background: none;
display: block;
}
scripts:
<?php
?>
<style>
<?php include 'header.css'; ?>
</style>
<?php
echo '<div class="page_m">';
?>
<style>
<?phpinclude 'style_m.css';?>
</style>
<?php
echo '<pre class="page_inner_m">';
//header start
echo '<div class="menu_m">';
$host = $_SERVER['HTTP_HOST'];
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
$domain = "{$matches[0]}\n";
echo '<center class="title_m">'.$domain.'</center>';
echo '</div>';
//header end
echo '</pre></div>';
echo '</div>';
?>
Fixed it :D just needed to replace echo '<pre class="page_inner_m">'; with echo '<body class="page_inner_m">'; and replace echo '</pre></div>'; with echo '</body></div>';
I'll keep this up incase anyone else finds it helpful. switching the <pre> tag with a <body> tag solved the problem for me.
I am trying to join the the footer-document to the index-file. But it does not work and I suspect there i something wrong with my css-file.
html {background: url("bakgrund.gif");}
/*https://pixabay.com/ Gratis bilder Creative Commons CC0*/
html { overflow-y: scroll;}
body {
background: white;
border: 1px solid #0000ff;
font-family: calibri, arial, sans-serif;
width: 750px;
margin: 25px auto;
padding: 0;
}
header {
height: 175px;
background-color: #edffff;
margin-top: -16px;
padding: 0;
}
nav {
height: 35px;
background-color: #edffff;
padding-left: 10px;
}
section {
width: 550px;
float: left;
min-height: 400px;
}
article {
width: 550px;
float: left;
background-color: yellow;
}
aside {
width: 200px;
float: right;
background-color: lightgrey;
}
footer {
clear: both;
position: relative;
height: 55px;
padding: 5px ;
text-align: center;
background-color: magenta;
}
address {
font-size: 12px;
font-style: normal;
}
/* Menykataloger */
ul {
margin: 0;
padding: 0;
}
#meny li {
display: inline;
padding: 5px 1px;
}
#meny li a {
margin: 0 5px 0 5px;
padding: 5px 15px;
text-align: center;
font-family: arial;
font-size: 13px;
font-weight: bold;
color: black;
border: 1px solid black;
border-radius: 5px;
background: yellow;
}
#meny li a:hover {
background: #CCEBFF;
color: black;
}
#meny a:link, #meny a:visited {
color: black;
text-decoration: none;
}
#meny a:active {
color: white;
}
#meny a#current {
background: white;
}
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="stil.css" type="text/css">
</head>
<body>
<nav>
<ul id="meny">
<li>Hem</li>
<li>AAA</li>
<li>BBB</li>
<li>CCC</li>
</ul>
</nav>
<section>
<h2>Huvudrubrik</h2>
<p>Huvudinnehåll</p>
<article>
<h2>Rubrik 1</h2>
<p> Innehåll 1 med rubriker</p>
</article>
<article>
<h2>Rubrik 2</h2>
<p> Innehåll 2 med rubriker
</p>
</article>
</section>
<aside>
Nyhetsbrev H-spalt
</aside>
<?php include("fot.php"); ?>
The result is wrong with the interpretation of the border. It just encircles the head and not the whole area.
I Get your problem
why dont you start your file with < ? php at begining and close it at the end
instead which you've used like this => "< ? php include("fot.php");" ?> at the end of your second file if you can see.
and save the main html file with the extension .php
trust me nothing will happen to your html code all the html contents will run fine even if you save the file in .php
and the second thing is you can include in two ways
i.e
include 'filename';
or
require 'filename'; you better include at the starting of the file
who would know if that included file may come to use right from the begining
Thanking you!
I could not understand what you are trying to do, but your problem is due to float: left for section tag. There are many alternatives to float like flex and grid,, so don't prefer float. It will cause many problems. Your problem is listed here.
There is no problem with your php.
I'm using this WP theme and I'm struggeling to adjust the code so that the Title and Description in the content boxes only show on hover (at the moment they're always displayed and hover just makes the image go darker).
Here are the codes in question (as far as I can tell):
.home_featured_post_last { margin-right: 0; }
.home_featured_post_hover { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: block; text-decoration: none; border-radius: 5px; }
.home_featured_post_hover:hover { background: url('images/trans-back.png') repeat; text-decoration: none; border-radius: 5px; }
.home_featured_post_tbl { display: table; width: 100%; height: 100%; }
.home_featured_post_tbl_cell { display: block; text-align: center; vertical-align: middle; color: #fff; text-shadow: 1px 1px #000; font-size: 14px; font-family: Arial, Helvetica, sans-serif; color: #fff; letter-spacing: 1.5px; font-weight: 400; }
.home_featured_post_tbl_cell h3 { text-shadow: 1px 1px #000; font-size: 19px; font-family: Arial, Helvetica, sans-serif; color: #fff; letter-spacing: 1.5px; font-weight: 700; }
<a class="home_featured_post_hover" href="<?php the_permalink(); ?>">
<div class="home_featured_post_tbl">
<div class="home_featured_post_tbl_cell">
<h3><?php the_title(); ?></h3>
<p><?php echo ds_get_excerpt('40'); ?></p>
</div><!--//home_featured_post_tbl_cell-->
</div><!--//home_featured_post_tbl-->
</a><!--//home_featured_post_hover-->
As suggested in some other posts, I've tried adding visibility: hidden; and visibility: visbile; to the CSS in various different combinations but either it just hides the text completely or it doesn't work at all. Does this have to do with how the PHP code is formated? Any thoughts on how to do this?
Sorry if this is really obvious - I can't work it out.
Try adding these CSS lines... if you want a smoother effect, you can add the css transition property!
a.home_featured_post_hover .home_featured_post_tbl_cell { opacity:0; }
a.home_featured_post_hover:hover .home_featured_post_tbl_cell { opacity:1; }
What this does is basically make the title/desc div transparent, then show it when the mouse is over the link.
I don't even know if I'm doing this correctly, but I thought I'd ask to get a better opinion. Basically what I've done is this: created an information/navigation bar that expands depending on tab clicked by the user. What I'm trying to add is the functionality to expand a certain tab and be forwarded to it (like what this link would do: <a href="#contactus">) based on a link earlier on the same page. I can't seem to do it. The tab that should be opened is contained within a <ul><li> list and is hidden. I'll include the code:
<div id="tab1">
<ul class="tablinks">
<li><span>Check-Out</span></li>
<li><a onClick="show('tab2')">Payment</a></li>
</ul>
<table>
<tr>
<td><img alt=Check-Out src="http://link.com/images/checkouticon.gif" width=48px height=45></td>
<td>
<p style="font-family: arial,helvetica,sans-serif; font-size: 12px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px">information</p>
</td>
</tr>
</table>
<div class="tabbase"></div>
</div>
<!-- tab 2 -->
<div id="tab2">
<ul class="tablinks">
<li><a onClick="show('tab1')">Check-Out</a></li>
<li><span>Payment</span></li>
</ul>
<table>
<tr>
<td vAlign=top align=left><img alt=Check-Out src="http://link.com/images/paypalicon.gif" width=48px height=45></td>
<td>
<p style="font-family: arial,helvetica,sans-serif; font-size: 12px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px">information</p>
</td>
</tr>
</table>
<div class="tabbase"></div>
</div>
This is the CSS that affects it:
#tab1, #tab2, #tab3, #tab4, #tab5, #tab6, #tab7 { font-family: trebuchet ms, Helvetica, sans-serif; height:550px;}
#tab1, #tab2, #tab3, #tab4, #tab5, #tab6, #tab7 {
width: 750px;
font-family: "trebuchet ms", tahoma, verdana, sans-serif;
font-size: 11px;
}
#tab2, #tab3, #tab4, #tab5, #tab6, #tab7 {
display: none;
}
ul.tablinks {
width: 600px;
margin: 20px 0px 0px 0px;
padding: 0px;
list-style: none;
height: 23px;
display: block;
cursor: pointer;
border-bottom: 0px solid #fff;
}
ul.tablinks li {
display: inline;
float: left;
margin: 0px 4px 0px 0px;
padding: 0px;
}
ul.tablinks li a, ul.tablinks li a:visited {
display: block;
width: 79px;
height: 23px;
line-height: 23px;
text-align: center;
text-decoration: none;
font-weight: normal;
font-size: 11px;
background: url(http://link.com/images/tabout3.gif);
color: #ffffff;
}
ul.tablinks li span {
display: block;
width: 79px;
height: 23px;
line-height: 23px;
text-align: center;
text-decoration:underline;
font-weight: normal;
font-size: 11px;
}
ul.tablinks li a:hover,
ul.tablinks li a.hover {
background: url(http://link.com/images/tabover.gif);
color: #000;
}
ul.tablinks li a:active{
text-decoration:underline;
}
div.tabbase {
display: block;
height: 3px;
line-height: 8px;
font-size: 0px;
}
div.tabbase {
background: url(http://link.com/images/boxbase3.gif);
}
And last but not least this is the code that is within a .php external file that affects the hidden aspect of the tabs:
function show(id)
{
checkseo()
if (err == "1"){return;}
hide()
if(ie5 || ns6){
//document.getElementById(id).style.display = "inline";
document.getElementById(id).style.display = "block";
}
}
function hide(){
if(ie5 || ns6){
document.getElementById('tab1').style.display = "none";
document.getElementById('tab2').style.display = "none";
document.getElementById('tab3').style.display = "none";
document.getElementById('tab4').style.display = "none";
document.getElementById('tab5').style.display = "none";
document.getElementById('tab6').style.display = "none";
document.getElementById('tab7').style.display = "none";
}
}
So the idea is to be able to insert a link earlier in the document to open the "Payment" tab. I tried something like this: Payment Information and changed the tags for the list to: <li><span name="payments">Payments</span></li>. This didn't work unless I had already clicked on the "Payments" tab and opened it and then clicked on the link. Then my screen would scroll down and focus on that area. Is there a way to have the screen scroll down and view the <span> without having to 'open' it first?
Thanks for all your help in advance. And I should note, that while I do have some ability with HTML, Javascript, and PHP, I'm still learning and don't know all of the best ways of doing things.
The best (and easiest) way to code this is to use a JS framework like jQuery. It'll help tremendously in normalizing the browser differences.
But if that's not an option, let's try to fix the existing code. Payment Information will jump to an element with the id="payments", not name. Once you fix that, add an onClick="show('tab2')" to that <a>.
In the show function, what is the point of this code if(ie5 || ns6)? This is basically saying, if it's IE5 or Netscape6, then show the element (assuming the variable ie5 and ns6 are set properly somewhere of course). Try removing this, I don't think you need it.