To achieve the desired layout, you can utilize the CSS Property word-wrap
in conjunction with the width
attribute.
For a demonstration of the solution, please refer to this link.
HTML Code:
<div id="top">
<div id="top-border">abc</div>
<div id="op-menu"> <jdoc:include type="modules" name="top-menu" style="well" />def</div>
</div>
CSS Code:
#top {
width:100%;
height:40px;
overflow: hidden;
}
#top-border {
background: url(../images/border.png) repeat-x scroll 0px 18px red;
position: relative;
/*width:74%;*/
height:40px;
float:left;
overflow: hidden;
width: 20px;
word-wrap: break-word;
}
#top-menu {
margin:0;
float:right;
height:40px;
padding-top:6px;
}
I trust this information proves beneficial.
EDIT
If a dynamic width is required, consider this solution.
HTML Code:
<div id="top">
<div id="top-border">The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. </div>
<div id="op-menu"> <jdoc:include type="modules" name="top-menu" style="well" />def</div>
</div>
CSS Code:
#top {
width:100%;
height:40px;
overflow: hidden;
}
#top-border {
background: url(../images/border.png) repeat-x scroll 0px 18px red;
position: relative;
/*width:74%;*/
height:40px;
float:left;
overflow: hidden;
width: 97%;
word-wrap: break-word;
}
#top-menu {
margin:0;
float:right;
height:40px;
padding-top:6px;
}
This updated solution should address any concerns.
EDIT - 2
Take a look at this alternative approach, which adapts the box size based on its content rather than preset dimensions.
HTML Code:
<div id="top">
<div id="top-border">The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. The Quick Brown Fox jumps Over The Lazy Dog. </div>
<div id="top-menu"> <jdoc:include type="modules" name="top-menu" style="well" />def</div>
</div>
CSS Code:
#top {
width:100%;
height:40px;
overflow: hidden;
display:table-row;
}
#top-border {
background: url(../images/border.png) repeat-x scroll 0px 18px red;
position: relative;
/*width:74%;*/
height:40px;
display:table-cell;
}
#top-menu {
margin:0;
height:40px;
padding-top:6px;
background:green;
display:table-cell;
}
Hopefully, this revised approach meets your needs.