Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Modure Rares
Courses Plus Student 9,041 PointsHTML and CSS problem? ( elements have height = 0)
Hello. I have a problem. Can anybody tell me why my div has height = 0 if it has other elements inside it???? Here is the code
<div class = "content-wrapper">
<img src="img.jpg"/>
<ul>
<li>content</li>
<li>content</li>
<li>content</li>
<li>content</li>
</ul>
</div>
2 Answers
Fahad Mutair
10,359 PointsFor html you need html doctype, head, body tags
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="./css.css">
</head>
<body>
<div class = "content-wrapper">
<img src="img.jpg"/>
<ul>
<li>content</li>
<li>content</li>
<li>content</li>
<li>content</li>
</ul>
</div>
</body>
</html>
Modure Rares
Courses Plus Student 9,041 PointsWHAT???
Fahad Mutair
10,359 PointsModure Rares can you show me your full html code , please?
Modure Rares
Courses Plus Student 9,041 Points<?php
include("include/functions.php");
include("include/products.php");
if(isset($_GET["id"])){
$id = $_GET["id"];
if(isset($catalog[$id])){
$item = $catalog[$id];
}
}
if(!isset($item)){
header:("location:catalog.php");
exit;
}
$pageTitle = $item["title"];
$secetion = null;
include("include/header.php");
?>
<div class="content-wrapper">
<div class="media-image">
<img src=" <?php echo $item["img"]; ?> ">
</div>
<div class="media-details">
<h1 class="product-title"><?php echo $item["title"]; ?></h1>
<table id="details-table">
<tr>
<th>Category</th>
<td><?php echo $item["category"]; ?></td>
</tr>
<tr>
<th>Genre</th>
<td><?php echo $item["genre"]; ?></td>
</tr>
<tr>
<th>Format</th>
<td><?php echo $item["format"]; ?></td>
</tr>
<tr>
<th>Year</th>
<td><?php echo $item["year"]; ?></td>
</tr>
<?php if(strtolower($item["category"]) == "books"){ ?>
<tr>
<th>Authors</th>
<td><?php echo implode(", ",$item["authors"]); ?></td>
</tr>
<tr>
<th>Publisher</th>
<td><?php echo $item["publisher"]; ?></td>
</tr>
<tr>
<th>ISBN</th>
<td><?php echo $item["isbn"]; ?></td>
</tr>
<?php }elseif(strtolower($item["category"]) == "movies"){ ?>
<tr>
<th>Director</th>
<td><?php echo $item["director"]; ?></td>
</tr>
<tr>
<th>Actors</th>
<td><?php echo implode(", ",$item["stars"]); ?></td>
</tr>
<tr>
<th>Writers</th>
<td><?php echo implode(", ",$item["writers"]); ?></td>
</tr>
<?php }elseif(strtolower($item["category"]) == "music"){ ?>
<tr>
<th>Artist</th>
<td><?php echo $item["artist"]; ?></td>
</tr>
<?php } ?>
</table>
</div>
</div>
</body>
</html>
Fahad Mutair
10,359 Pointshi Modure Rares ,i think you need to put Html tags at beginning
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="./css.css">
</head>
<body>
Modure Rares
Courses Plus Student 9,041 PointsModure Rares
Courses Plus Student 9,041 Pointsthis is the css