My File names: 1.) about.php 2.) styles.css
The same stylesheet is also applied to index.php .
I want to style the section part of the page. I tried it by styling the [Eg.], .section-info{color:#555;}
but it didn't helped. Also should I change the stylesheet name to styles.php? Thanks In Advance.
<?php /* Website Header */ include ("include/header.php"); ?> <!-- Website Page-2 Main Content --> <div class="wrapper"> <section> <div class="section-info"> <h2>About Us</h2> <p>blah...blah...bllah....</p> </div> </section> </div> <?php /* Website Footer */ include ("include/footer.php"); ?>
尝试给它不同的类或内联样式。
I had a similar problem. I created a function here which I use.
Then I use $page = getPage("ab")
which would return about
and then you can check what page is in use using the below:
<?php
$page = getPage("ab");
if ($page == "about") { ?>
<style type="text/css">
.section-info {
background: #f00;
}
</style>
<?php } ?>
Put this code inside the <head>
of your about.php
page. This will apply whatever code you want to that page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.