Log In · Register

 
I need some CSS Support
Medi
post Apr 9 2009, 08:42 PM
Post #1


Coming from Illinois
*****

Group: Member
Posts: 319
Joined: Mar 2009
Member No: 718,627



How do you style text to be like newspaper style? Here's what I mean (photoshopped)



all within the same div (because I only want one scrollbar)
 
 
Start new topic
Replies
fixtatik
post Apr 9 2009, 09:20 PM
Post #2


Senior Member
******

Group: Member
Posts: 1,237
Joined: May 2008
Member No: 648,123



within the same div without using separate divs inside is somewhat possible, but it's a little bit of an ugly result.
CODE
<style type="text/css">
div { height:300px; margin:0 auto; overflow:auto; width:500px; }
p { float:left; margin:10px; width:210px; }
</style>

<div>
  <p>text</p>
</div>

it unfortunately won't look exactly like a newspaper column, as each paragraph will be next to one another, rather than going down, then starting a new column.

the issue is because if you have the text within a scrolling div, the browser won't know when to start a new column, unless you use divs nested within divs, like this:
CODE
<style type="text/css">
.main { height:300px; margin:0 auto; overflow:auto; width:500px; }
.column { float:left; height:600px; margin:10px; width:210px; }
</style>

<div class="main">
  <div class="column">
    <p>text</p>
  </div>
  <div class="column">
    <p>text</p>
  </div>
</div>

of course, you'd just have to change the heights and widths to what you're looking for.

edit: if this wasn't for myspace, you could write a PHP script (or any script) that counts the number of characters or words in one column, then starts a new one. you can also do columns in CSS 3, if everyone who visits your profile uses a browser that supports CSS 3.
 

Posts in this topic


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: