Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-27-2013, 01:03 PM   PM User | #1
edgich
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
edgich is an unknown quantity at this point
New to php

I've been self learning php and i know the basic concepts and i decided to put it to practice by creating a php blog. i'm having trouble styling it with css.Any suggestions.


HTML

<!DOCTYPE html>
<html>
<head>
<title>Kagori mainpage</title>
<link rel="stylesheet" type="text/css" href="kagori.css">
</head>
<body>
<div class="header" >
<ul>
<li><a href="kagori.php">Home</a></li>
<li><a href="about.php">About</a></li>
<li><a href="contact.php">Contact us</a></li>
</ul>
</div>
<div class="banner"></div>
<div class="content" >
My Blog<hr/>
<?php
$sql=mysql_query("SELECT*FROM kgtable ORDER BY id DESC");
while($row=mysql_fetch_array($sql)){
$title=$row['title'];
$content=$row['content'];
$category=$row['category'];
?>
<table>
<tr><td><?php echo $title?> </td><td><?php echo $category ?> </td></tr>
<tr><td colspan='2'> <?php echo $content?> </td></tr>
</table>
<?php
}
?>
</div>
<div class="footer"></div>

</body>
<html>

CSS
body {
background: #bfc4c0;
}
.header{
display: block;
position: absolute;
top: 0px;
width: 100%;
left: 0px;
height: 35px;
background: #313632;
}
.header ul {
margin: 0;
padding: 0;
}
.header ul li {
display: inline;
list-style-type: none;
}
.header li a {
color: #22eb57;
display: block;
float: left;
padding: 5px 10px;
text-decoration: none;
}
.header li a:hover {
text-decoration: underline;
}
.banner{
display: block;
position: absolute;
width: 1000px;
height: 300px;
background: url("http://i1273.photobucket.com/albums/y404/Edward_Gichuru/kagoribann_zps6e150f8d.jpg") center ;
top:45px;
left: 199px;
}
.content{
display: block;
position: absolute;
top: 360px;
width: 100%;
height: 300px;
left: 0px;
background: transparent;
}
.footer{
display: block;
position: absolute;
top: 700px;
width: 100%;
left: 0px;
height: 50px;
background: #313632;
}
edgich is offline   Reply With Quote
Old 01-27-2013, 04:18 PM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,498
Thanks: 18
Thanked 362 Times in 361 Posts
sunfighter is on a distinguished road
edgich, after posting here 6 times you should be aware of the hash mark (#) located above the Message box. Use that to generate the [code] tags and put your code inside of them please.

Also this is a css question not a php question and is in the wrong place.

There does not seem to be a question. Please ask or tell us what is not styling for you.
BTW, you don't style php. PHP generates html and you style that. If you want to know what I think you want to know add TABLE or TD or TR to the css.
Your code looks good. You don't show your connect to the DB, but I imagine you have it somewhere, right?

Last edited by sunfighter; 01-27-2013 at 04:21 PM..
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:43 AM.


Advertisement
Log in to turn off these ads.