简体   繁体   English

CSS无法包裹我的文字

[英]CSS cannot get my text to wrap

Surely im missing somthing simple here! 我肯定在这里缺少简单的东西! i have tryed fixes from other topics but everything i try just seems to make the problem worse. 我尝试过其他主题的修复程序,但是我尝试做的所有事情似乎都使问题变得更糟。 Any help any you could provide would be wonderful! 任何您能提供的帮助都将是美好的!

Basics: Im trying to make a web page that has a fixed headder. 基础知识:我试图制作一个具有固定标题的网页。 under that a fixed menu. 在那个固定菜单下。 then area for content / text / pictures. 然后是内容/文字/图片区域。 and on the right hand side a side bar where i can put buttons / calls to action. 在右侧边栏上,我可以在其中放置按钮/号召性用语。

im 90% there but i cant get my text to wrap. 我在那里有90%,但我无法包装文字。 i have tried various things. 我尝试了各种事情。 either my text goes over the top of or under the side bar. 我的文字在侧栏上方或下方。 maybe im thinking about this totally the wrong way. 也许我在想这是完全错误的方式。

*Edit im explaing my self a little wrong. *编辑我的解释我自己有点错误。 i would like the side bar to be the thing that makes the text wrap. 我希望边栏成为使文本自动换行的东西。

The code im using... 我正在使用的代码...

.cent {
  width: 984px ;
  margin-left: auto ;
  margin-right: auto ;
}


.main {
 clear: both; 
    display: block; 
    width: 964px; 
    padding: 0px;
    margin:189px 0px 0px 10px;
    font-family:Arial, Helvetica, sans-serif;
    background:#FF0;
}

.ctar{
    float:right;  
    display:inline;
    padding: 0px;
    margin:0px -10px 0px 10px;
    background: #F0F ;
    width: 200px;
    right:0px;
    bottom:0px;
    top:0px;

}

i have created a JSFiddle here incase some other code was affecting it 我在这里创建了一个JSFiddle,以防其他代码影响它

Thanks in advance! 提前致谢!

you might want to give the non-sidebar content a width too. 您可能还想给非侧边栏内容设置一个宽度。 Check this jsfiddle I just made for you: http://jsfiddle.net/mY584/3/ 检查一下我刚刚为您制作的jsfiddle: http : //jsfiddle.net/mY584/3/

CSS added: CSS添加:

#bodycontent{
float:left;
padding: 0px;
margin:0px -10px 0px 0px;
background: #F0F;
width: 740px;
right:0px;
bottom:0px;
top:0px;
word-wrap:break-word;}

LIke this just add word-wrap:break-word; 像这样,只需add word-wrap:break-word; in selector p 在选择器p

demo 演示

css 的CSS

p{
    word-wrap:break-word;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM