473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Text overflows column 1 of a two column CSS layout

I created a two column CSS layout by
floating the columns left and right respectively.

When I put text into the first column (via HTML) it continues in
a straight line through the second column and beyond
instead of going onto a new line within the first
column when it reaches the right hand edge of the
first column.

The code is below. Main is the name of the left hand
column and ads is the name of the right hand column.

If you've got the time, have you any idea what is
wrong.

Regards

Jim Walsh



[code] (CSS )

body{
margin:0;
padding:0;
background-color:#0000cc;
min-width:750px
}

div.wrap{
background-color:#cc0000;
margin:0 auto;
padding:0;
width:750px
}

div.header{
background-color:#ddd;
margin:0;
padding:5px;
text-align:center
}

div.links1{
background-color:#c99;
padding:5px
}

div.links2{
background-color:#cc9;
padding:5px
}

div.main{
float:left;
width:500px;
background-color:#cc0000;
padding:0 10px
}

div.ads{
background-color:#c9c;
float:right;
width:150px;
padding:0 10px
}

div.links1 ul{
margin:0;
padding:0;
list-style:none
}

div.links2 ul{
text-align:center;
word-spacing:15px;
margin-bottom:0;
margin:0;
padding:0;
list-style:none
}

div.links1 li
{background-color:orange;
margin:20px;
display:inline;
margin-left:20px;
margin-right:20px
}

div.links2 li{
display:inline;
margin:0;
padding:0
}

h5{
text-align:center;
padding:0 10px
}

a{

text-decoration:none;
border-style:ridge;
border-color:blue;
padding-left:10px;
padding-right:10px
}

a:link{
color:black;
background-color:orange;
}

a:active{
color:white;
background-color:teal
}

a:visited{
color:purple;
background-color:#aa11aa}

[code](END OF CSS)

[code] HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<title>Visit Bangkok Accomodation</title>
<link rel="stylesheet" type="text/css" href="bkkcss.css"></link>

</head>
<body>

<div class="wrap">

<div class="header">
<h1>Visit Bangkok</h1>
</div>


<div class="links1">
<ul>
<li><a href="bkkaccomodation.html">accomodation</a></li>
<li><a href="bkkplacestogo.html">places to go</a></li>
<li><a href="bkkwhatson.html">what's on</a></li>
<li><a href="bkktravel.html">travel</a></li>
<li><a href="bkkmapsandguides.html">maps and guides</a></li>
<li><a href="bkkpeoplelikeyou.html">people like you</a></li>
</ul>
</div>


<div class="links2">
<ul>
<li><a href="bkkhotels.html">hotels</a></li>
<li><a href="bkkapartments.html">apartments</a></li>
<li><a href="bkkselfcatering.html">selfcatering</a></li>
<li><a href="bkkhomestay.html">homestay</a></li>
<li><a href="bkkcamping.html">camping</a></li>
<li><a href="bkkcaravans.html">caravans</a></li>
</ul>
</div>

<div class="main">
testqertyuiop[]asdfghjkl;'zxcvbnm,./qwertyuiop[sdfghjkl;zxcvbnm,,.qwertyuiop[asdfghjkl;zxcvbnm,qwertyuiop[asdfghjkl;zxcvbnm,qwertyuuii
</div>


<div class="ads">

<h5>Sponsored Advertisements</h5>

</div>


</div>
</body>
</html>

[code] END OF HTML
Aug 19 '07 #1
1 1970
phvfl
173 Expert 100+
Hi Jim,

The text is overflowing because there is not break in the string for there to be a line break. If the length of a single word or string is greater than the width of the container then the string will overflow. The behavior of this can be controlled using the CSS overflow property. There are four values for this: auto, visible, hidden and scroll.

Auto - automatically determines the overflow property, usually visible although for a textarea would be scroll.

Visible - the overflowed content is visible (as in your case)

Hidden - the overflowed content is hidden and there is no sign that there is overflowed content.

Scroll - a scroll bar is added so that the information can be seen. While this is useful as it ensures no information is lost or overlaps another element accidentally it can lead to an untidy looking page.

If you do not want the overflow ensure that either no single word is longer than the width of the column or specify the overflow behavior to either hidden or scroll.
Aug 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Zak McGregor | last post by:
Hi all I have a simple 3 column css layout here: http://www.carfolio.com/newlook.dhtml However, when the centre column is wider than the screen (yes, it does happen on some pages on the site...
13
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
14
by: Eric Lindsay | last post by:
I've seen a page using display, and especially display table that did some neat things with boxes, but basically it only worked with Mozilla browsers. Fell over fairly badly with Opera and Safari...
3
by: hikums | last post by:
I have taken a table snapshot, and noticed two tables with high overflows. What should be done, if any. Table Schema = CASTING Table Name = ABC Table Type = User Data...
18
by: ~john | last post by:
Sorry if this is a dumb question buy my CSS is pretty bad... but how do I get text to center vertically within a div tag? Here's my code below... the text is displaying on the far top-right. I...
1
by: jimchapuk | last post by:
I created a two column CSS layout by floating the columns left and right respectively. When I put text into the first column (via HTML) it continues in a straight line through the second column...
2
by: TyIzaeL | last post by:
This problem I'm having has me stumped. What is happening is I have a three column layout for a clan web portal and text in the left/right columns spills out of the side if the line is long enough....
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
4
by: Jeff | last post by:
Hey I'm wondering how the Fixed-Width Text Format is What I know is that the top line in this text format will contain column names. and each row beneath the top line represent for example a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.