Issue
I have a file, heard.php where have all PHP code, here is the PHP code which I think making the problem:
<nav class="link_wechsel">
<ul>
<li><a <?php if ($current_page=="1"): ?>aria-current="page" <?php endif ?> href="prove-1.php">1</a></li>
<li><a <?php if ($current_page=="2"): ?>aria-current="page" <?php endif ?> href="prove-2.php">2</a></li>
<li><a <?php if ($current_page=="3"): ?>aria-current="page" <?php endif ?> href="prove-3.php">3</a></li>
</ul>
</nav>
and here is all Code from the heard.php file:
<?php
header("Content-Type: text/html; Charset=utf-8");
mb_internal_encoding('UTF-8');
date_default_timezone_set('UTC');
error_reporting(E_ALL);
?>
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>header-beispiel</title>
</head>
<style>
.link_wechsel ul {
list-style-type: none;
margin-left: 340px;
}
.link_wechsel li { display: inline; }
.link_wechsel a {
display: inline;
text-decoration: none;
border: 1px solid gray;
background-color: #FE2E64;
color: black;
padding: 8px;
opacity: 0.5;
font-family: Times New Roman;
}
.link_wechsel a:hover { background-color: #9f9e9e; }
.link_wechsel a.[aria-current=page] {
background-color: green;
}
</style>
<body>
<header>
</header>
<nav class="link_wechsel">
<ul>
<li><a <?php if ($current_page=="1"): ?>aria-current="page" <?php endif ?> href="beispiel-1.php">1</a></li>
<li><a <?php if ($current_page=="2"): ?>aria-current="page" <?php endif ?> href="beispiel-2.php">2</a></li>
<li><a <?php if ($current_page=="3"): ?>aria-current="page" <?php endif ?> href="beispiel-3.php">3</a></li>
</ul>
</nav>
</body>
</html>
Then I have three files where display this code, Prove-1.php, Prove-2.php and Prove-3.php, here the Code:
<?php
$current_page = "1";
require 'header.php';
header("Content-Type: text/html; Charset=utf-8");
mb_internal_encoding('UTF-8');
date_default_timezone_set('UTC');
error_reporting(E_ALL);
?>
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>prove-1</title>
</head>
<body>
<h3>Page 1</h3>
</body>
</html>
On all Three File I have identical Code, only to change $current_page = "1"; , with $current_page = "2"; and $current_page = "3";.. a Screenshot how to see the Page , here..
As your can see, the color not change of the page number that is currently selected.
The CSS Code, which say does it...
.link_wechsel a.[aria-current=page] { background-color: green; }
Can someone please anyone help me and found a solution from my problem, Thanks!
Solution
I found the Problem because the color not change of the page number that is currently selected .
That Problem was on CSS .
I wrote,
.link_wechsel a.[aria-current=page] { background-color: green; }
when I would to do
.link_wechsel a[aria-current=page] { background-color: green; }
without the Point after a . Because aria-current is a attribute and page its Value , therefore the a tag , not need a Point . How to see now without Point...
Answered By - 3edf1w
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.