PDA

View Full Version : How can I wrap inline text in css?[FIXED]


darkmage784
09-20-2005, 10:56 PM
I'm using XML and XSL to create a template for reports. I want the title of sections in the margin. Here is my code(in the xsl template):

<html>
<head>
<style type="text/css">
div{margin-left: 2cm; width: 10px; }
</style>
</head>
<body>
<b>Section One</b>:
<div><xsl:value-of select="//partOne" /></div>

</body>
</html>

I do not want it to break between the div and the title in the margin, but I do want it to wrap. display: inline fixes the break, but messes up the wrapping. Does anyone have a solution for this?

_Aerospace_Eng_
09-20-2005, 11:24 PM
Put the title in a header (h* tag) of its own set a width to it, float it to the left, the next div should move up next to the title.

darkmage784
09-20-2005, 11:37 PM
Ok, that *almost* fixed it. Now the div is slightly above the title. For some reason, position: relative; top: 12px; fixes it, but relative values(%) do nothing. Why is that???
Another problem: when I added lots of headers, they all indented a bit. Why is that, and how can I fix it?

_Aerospace_Eng_
09-21-2005, 12:24 AM
You will have to set the margin and padding to 0
h1, h2, h3, h4, h5, h6 {
margin:0;
padding:0;
}

darkmage784
09-21-2005, 12:30 AM
Thanks, it works great.

darkmage784
09-21-2005, 12:31 AM
accidental repost