简体   繁体   English

在响应式CSS和HTML网站中向下推侧边栏

[英]Pushing sidebar down in responsive CSS and HTML website

Is there a way to make a sidebar collapse to the bottom of the page without any JavaScript when the browser reaches a certain size. 当浏览器达到特定大小时,有没有一种方法可以使侧边栏折叠到页面底部而无需任何JavaScript。

I'm creating a responsive theme that can be seen at http://flexibletheme.tumblr.com/ . 我正在创建一个响应性主题,可以在http://flexibletheme.tumblr.com/上看到。 By resizing your browser window to below 600px, the theme goes into a linear version (just resize your browser smaller until it changes to this). 通过将浏览器窗口的大小调整为600px以下,主题将变为线性版本(只需将浏览器的大小调整为较小,直到更改为该大小)。

At the top the sidebar changes into a full menu, and this is the part which I want to go to the bottom instead of staying at the top. 在顶部,侧边栏变为完整菜单,这是我要转到底部而不是停留在顶部的部分。

The relevant parts of the CSS code are @media screen and (max-width: 600px) [this tells the browser to use the specified CSS when the browser is less than 600px], the sidebar using the HTML 5 element called CSS代码的相关部分是@media屏幕和(最大宽度:600像素) [这告诉浏览器在小于600像素时使用指定的CSS],侧栏使用称为HTML 5的元素 , and each post is wrapped in ,并且每个帖子都包裹在 .

Have you tried moving the entire aside block underneath the container? 您是否尝试过将整个旁边的方块移动到容器下方? I'm still learning responsive web design myself, but my understanding is that if you structure your html for the smallest size you want to accommodate, you will have a cleaner layout with less hacks. 我仍在自己学习响应式网页设计,但是我的理解是,如果将HTML构造为要容纳的最小尺寸,则布局将更干净,hack次数更少。

将侧边栏放置在#container div中,然后将部分向左浮动,将侧边栏向右浮动。

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

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