css代码:
<style>
.wrapper {
margin: 0 auto;
overflow: hidden;
width: 950px;
}
#box2 a{
color: blue;
}
</style>
html代码:
<div class="wrapper">
<div id="box1">
<p>Using XCLASSes is fragile: Neither the core, nor extensions authors can guarantee that XCLASSes do not break if the underlying code changes (for example during upgrades). Be aware that your XCLASS can easily break and has to be maintained and fixed if the underlying code changes. If possible, you should use a hook instead of an XCLASS. If the given code does not provide a hook for your specific problem, you could ask the extension author or the core to implement a hook.
</p>
</div>
<div id="box2">
<p><a href="#">school</a></p>
<p><a href="#">Job Club</a></p>
<p><a href="#">member</a></p>
</div>
<div id="box3">
<table>
<tr>
<td class="item-header">Career Resources</td>
</tr>
<tr>
<td class="item">Workbook+ 200 online resources</td>
</tr>
<tr>
<td class="item">Personal Career Management Dashboard</td>
</tr>
<tr>
<td class="item">Job Searching and Resume Posting</td>
</tr>
</table>
</div>
</div>
问题:
现在它显示如下:
box1
box2
box3
如果不更改html代码,只更改css代码,是否可以使其显示如下?
box1 box3
box2
我的意思是让box3
与box1
对齐,这可能吗?
答案 0 :(得分:1)
见This Fiddle。您需要使用包装器position
absolute
.wrapper {
margin: 0 auto;
overflow: hidden;
width: 950px;
position: relative;
}
#box2 a{
color: blue;
}
#box1, #box2, #box3 {
width: 450px;
}
#box1, #box2 {
margin-right: 50px;
float: left;
}
#box3 {
position: absolute;
right: 0;
}
框{/ 1}}
<强> CSS 强>
{{1}}
答案 1 :(得分:0)
尽管原油解决方案:
div#box2和#box3的顺序相反。
.wrapper{
border: 1px solid #888;height:600px;width:300px;
}
#box3 {
border: 1px solid #888;background-color:#CCC;width:300px;float:left;
}
#box2 {
border: 1px solid #888;background-color:#CCC;width:800px;height:130px;float:left;
}
#box1 {
background-color:#CCC;width:300px;min-height:100px;float:left;border: 1px solid #888;
}