html - 如何使用始终可见的侧边栏正确布局正文?

标签 html css semantic-ui

如果我有一个 Semantic UI Sidebar它总是可见的(即设置了 visible 类),我如何正确布局相应的 pusher 以便它考虑侧边栏的宽度。长(或右对齐)元素似乎被切断,如本例所示:

<link href="https://rawgit.com/Semantic-Org/Semantic-UI/next/dist/semantic.min.css" rel="stylesheet" />
<script src="https://rawgit.com/Semantic-Org/Semantic-UI/next/dist/semantic.min.js"></script>
<div class="ui vertical left visible sidebar menu">
  <a class="item">
    <i class="trophy icon"></i>
    Achievements
  </a>
</div>
<div class="pusher">
  <div class="ui left aligned header">
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
  </div>
  <div class="ui right aligned header">
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
  </div>
</div>

请注意左对齐标题如何按预期移动到左侧(即考虑了侧边栏的宽度)但是第二行,即右对齐标题,被截断了——就好像布局没有一样不考虑推杆宽度的减小。

最佳答案

显然这是一个错误或功能请求,请参阅相关票证:[Sidebar] Allow Sidebar to Start Visible #649[Sidebar] Allow Always Visible #807 .

作为临时解决方案,我猜你可以这样做:

.pusher {
  width: calc(100% - 260px); /*260px is the sidebar width*/
}

.pusher {
  width: calc(100% - 260px);
}
<link href="https://rawgit.com/Semantic-Org/Semantic-UI/next/dist/semantic.min.css" rel="stylesheet" />
<script src="https://rawgit.com/Semantic-Org/Semantic-UI/next/dist/semantic.min.js"></script>
<div class="ui vertical left visible sidebar menu">
  <a class="item">
    <i class="trophy icon"></i>
    Achievements
  </a>
</div>
<div class="pusher">
  <div class="ui left aligned header">
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
  </div>
  <div class="ui right aligned header">
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z.
  </div>
</div>

关于html - 如何使用始终可见的侧边栏正确布局正文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34445329/

相关文章:

jquery - 在选择时更改输入字段的值

html - Bootstrap 表单页面在小尺寸屏幕上显示不正确

css - 网格行高均匀分布以匹配 ExtJS4 中的网格高度

jquery - 语义 UI "no javascript"工具提示 : Can we put part of the text in bold?

webpack - 模块解析失败 : error: semantic/dist/semantic. min.css 意外字符 '@' (11:0)

javascript - 需要将一个页面的 <div> 内容发送到另一页面的特定 <div>

javascript - 在使用 Javascript 或 HTML 提交之前修改输入值

css - 使用 CSS 在 div 的两侧添加箭头?

jquery - 如何为选定的日期选择器日期着色?

css - 自定义 semantic-ui-react (npm)