Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS layout help - Multiline address

Tags:

css

I'm trying to display an address right aligned in the footer of my page like this:

1234 south east Main St.
    Nowhere, ID 45445
        (555) 555-5555

in my markup I have this:

<address>
   1234 south east Main St.
   Nowhere, Id 45445
   (555) 555-5555
</address>

How can I get this to layout properly without inserting <br /> in each line using css?

like image 637
Micah Avatar asked Jan 20 '09 18:01

Micah


People also ask

How do you make a table with multiple lines on long text in CSS?

When the text in a single table cell exceeds a few words, a line break (<BR>) may improve the appearance and readability of the table. The line break code allows data to be split into multiple lines. Place the line break code <BR> within the text at the point(s) you want the line to break.

How do you break a sentence into two lines in CSS?

We use the word–break property in CSS that is used to specify how a word should be broken or split when reaching the end of a line. The word–wrap property is used to split/break long words and wrap them into the next line.


2 Answers

hey try to use this use this

.address
{
white-space:pre;
text-align:right;
}
like image 143
Sulaiman Avatar answered Sep 22 '22 19:09

Sulaiman


You're going to have to add extra elements in there, either <br> as you suggest, or else something like:

   <address>
      <div class="street">1234 south east Main St.</div>
      <div class="state">Nowhere, Id 45445</div>
      <div class="telnum">(555) 555-5555</div>
   </address>
like image 37
Rowland Shaw Avatar answered Sep 21 '22 19:09

Rowland Shaw