Log in

View Full Version : Put label and content in different container without line breaking them



Wdblazer
01-04-2011, 01:15 PM
I have label or heading beside each information, and I want to bold them to make them stand out, but so far I have only success in line breaking them before they will work. How do I bold or put the label and the information in two different containers without them line breaking?



echo "<div class=\"eventHeading\">";
echo "Time";
echo "<div class=\"eventInfo\">";
echo "$eventTime";
echo "</div>";
echo "</div>";


It is suppose to appear like this

TIME:$eventTime

coothead
01-04-2011, 06:26 PM
Hi there Wdblazer,

If you use...


echo "<div class=\"eventHeading\">";
echo "Time";
echo "</div>";
echo "<div class=\"eventInfo\">";
echo "$eventTime";
echo "</div>";

...instead, then your page would look something like this...


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english">
<meta http-equiv="Content-Style-Type" content="text/css">

<title>time and event time</title>

<style type="text/css">
.eventHeading {
float:left;
padding-right:5px;
font-weight:bold;
text-transform:uppercase;
}
.eventInfo {
float:left;
}
</style>

</head>
<body>

<div class="eventHeading">time:</div>
<div class="eventInfo">$eventTime</div>

</body>
</html>

coothead

Wdblazer
01-05-2011, 05:12 AM
I tried, but the result would look like this with a link break.

Time:
$eventTime

Edit: Problem solved, I use span class for the $eventTime instead of div class, so they are still on the same line.