user2610699
user2610699

Reputation: 39

DIV using CSS layout Basic

hi guys i'm trying to create a layout and understand using CSS and div. it seems like i'm having a hard time making the center column fixed in the center, cause everytime i type a long text it exceeds the right column, what's the best way to avoid this? Any easier method to use to understand? i'm beginner and i used to use TABLES AND TD's, it's easier to understand, but i'm trying to catch up with divs cause tables and rows seems obsolete. Please help thanks.

Here's my code: http://jsfiddle.net/CVXKn/2/

<div id="wrapper" align="center">

        <div id="wrapper_inner">

            <div id="menubar">MENU BAR GOES HERE</div>

            <div id="headerContainer">Header LOGO Goes here</div>

            <div id="bodyContainer">

                <div id="left"> </div>

                <div id="center"> gegggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg</div>
                    <div id="centerEnter"> </div>

                <div id="right"> </div>
                <div class="clear"> </div>

            </div>   

            <div id="footerContainer">Footer Goes Here</div>

         </div>

     </div>  

Upvotes: 0

Views: 366

Answers (5)

Love Trivedi
Love Trivedi

Reputation: 4046

You can use this css

#center {
word-wrap:break-word;
}

Upvotes: 0

everydayghost
everydayghost

Reputation: 691

Your problem is that you're using a single unbroken "word" to test your layout. A sentence will be cut off when there isn't enough space for the next word and will force a new line and keep going til there's no more text.

As others have pointed out, if you need to use lots of big words that'll break your layout use word-wrap: break-word; to break them where appropriate.

Upvotes: 0

Palin Revno
Palin Revno

Reputation: 586

word-wrap: break-word;

In the CSS of the center div should fix it.

Upvotes: 0

Mathijs Flietstra
Mathijs Flietstra

Reputation: 12974

You should set the word-wrap property on #center to break-word.

#center
{
  word-wrap: break-word;
}

Here's a jsFiddle

Here's a link to information about word-wrap.

Upvotes: 2

slash197
slash197

Reputation: 9034

Add this to your CSS, this will break long words

#center {
    word-wrap:break-word;
}

Upvotes: 0

Related Questions