htmlsidebar的简单介绍
华为云服务器特价优惠火热进行中! 2核2G2兆仅需 38 元;4核4G3兆仅需 79 元。购买时间越长越优惠!更多配置及优惠价格请咨询客服。
合作流程: |
今天给各位分享htmlsidebar的知识,其中也会对进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
微信号:cloud7591如需了解更多,欢迎添加客服微信咨询。
复制微信号
本文目录一览:
- 1、html 常见命名
- 2、HTML代码如何实现设置当前页面为首页
- 3、html5怎么设置网页过渡效果
- 4、CSS中的#sidebar是做什么用的呢
- 5、请问大神们,要怎样做一个sidebar浮在html页面上,可以隐藏和显示。谢谢
html 常见命名
常见命名
.wrap或.wrapper--用于外侧包裹
.container或.ct--包裹容器
.header--用于头部
.body--页面 body
.footer--页面尾部
.aside、sidebar--用于侧边栏
.content--和header footer对应,用于主要内容
.navigation--导航元素
.pagination--分页
.tabs .tab--tab切换
.breadcrumbs--导航列表、面包屑
.dropdown--下拉菜单
.article--文章
.main--用于主体
.thumbnail--头像、小图像
.media--媒体资源
.panel--面板
.tooltip--鼠标放置上去的提示
.popup--鼠标点击弹出的提示
.button、btn--按钮
.ad--广告
.subnav--二级导航
.menu--菜单
.tag--标签
.message或.notice--提示消息
.summary--摘要
.logo--logo
.search--搜索框
.login--登录
.register--注册
.username--用户名
.passwprd--密码
.banne --广告条
.copyright--版权
.modal或.dialog--弹窗
状态:
inverse--相反的
toggled--切换
switched--转换
original--起初的
initial--最初的
identified--识别
disabled--禁用
loading--加载
pending--等待
syncing--同步
default--默认
修饰:
dark--黑暗的
light--浅色的
shaded--深色阴影的
flat--平滑的
ghost--精灵
maroon--褐红色的
pale--白
intense--强烈的
twisted--扭曲的
narrow--狭窄的
wide--宽的
smooth--光滑的
separate--分离
clean--清洁的
sharp--锋利的
aligned--对齐的
元素:
pagination--分页
modal--情态动词
popup--弹出
article--文章
story--故事
flash--闪光
status--现状
state--州立
media--媒体
block--快
card-卡
teaser--挑逗
badge--徽章
label--标签
sheet--片材
poster--海报
notice--通知
record--记录
entry--入门
item--项目
figure--图
square--广场
module--模块
bar--酒吧
button--按钮
action--行动
knob--旋钮
布局:
navigation--航行
wrapper--包装器
inner--内部的
header--页眉
footer--页脚
aside--在一边
section--部分
divider--除法器
content--内容
container--容器
panel--面板
pane--窗格
construct--建造
composition--作文
spacing--间距
frame--框架
HTML代码如何实现设置当前页面为首页
不必设置为首页,只需要在连接到首页的连接href改为这个页面就可以了~
如果是浏览器打开的首页,那就是在浏览器设置中更改:(chrome)
(Firefox)
var homePage = {
is : function(url) { //IE判断当前页面是否主页
url = url || window.location.href;
if (document.all) {
//
document.body.style.behavior='url(#default#homepage)';
return document.body.isHomePage(url);
}
return false;
},
set : function(url) { //除了Chrome之外的FF和IE的设置方法
try {
url = url || window.location.href;
if (document.all) {
if (!homePage.is(url)) {
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage(url);
return homePage.is(url);
}
return true;
} else if (window.sidebar) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager
.enablePrivilege("UniversalXPConnect");
} catch(e) {
alert("请在浏览器地址栏输入“about:config”并回车" +
"然后将[signed.applets.codebase_principal_support]" +
"设置为“true”,点击“加入收藏”后忽略安全提示,即可设置成功。");
}
}
var prefs = Components.classes['@mozilla.org/preferences-service;1']
.getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage',url);
return true;
}
// Not support exception
return false;
} catch (e) {
return false;
}
}
}
对于Chrome暂时没有解决方案,上面的代码兼容IE和FF:
homePage.set(window.location.href);
html5怎么设置网页过渡效果
步骤1 创建空白的HTML 5模版
首先,我们创建一个空白的模版,代码很简单,如下所示:
复制代码
步骤2 增加HTML 5新标签 HTML 5中新增加了不少标签,如:
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section
在页面模版中,我们需要确保每个区域都能正确地对齐,因此需要使用HEADER、 NAVIGATION、 CONTENT、 SIDEBAR和Footer这些标签。代码如下所示:
复制代码
读者可能留意到这里使用的div id=”wrapper”,这个是稍候用来做meida query的时候调整全局CSS样式调整用的 步骤3 往HTML 5标签中增加代码
1)首先往标题中增加如下代码:
Simple HTML5 Template
复制代码
2)往导航标签中添加如下代码,这样很方便地构件了一个简单的页面分类导航:
Home About Parent Page Child
One Child Two with child Child One Child
Two Child Three Child Three
Contact
复制代码
3)使用标签来描述每一个要展示的内容实体,比如要展示的是多篇文章列表,其中的每一篇文章的具体内容就可以使用标签了。如下代码所示:
This is a title for post
Richard KS 20th March 2013 Tutorials HTML5, CSS3
and Responsive 10 Comments Lorem
Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the
1500s
复制代码
4)添加标签 HTML5提供的元素标签用来表示当前页面或文章的附属信息部分,可以包含与当前页面或主要内容相关的引用、侧边栏、广告、nav元素组,以及其他类似的有别与主要内容的部分。
根据目前的规范,元素有两种使用方法:
被包含在中作为主要内容的附属信息部分,其中的内容可以是与当前文章有关的引用、词汇列表等。
在之外使用,作为页面或站点全局的附属信息部分;最典型的形式是侧边栏(sidebar),其中的内容可以是友情链接、附属导航或广告单元等。
代码如下:
Categories Category 1 Category 2
Parent Category Child One Child Two
Grandchild One Grandchild Two Grandchild Three
Child Three Category 3
Text Lorem Ipsum is simply dummy
text of the printing and typesetting industry.
复制代码
5)加上最后的标签,代码为:
Copyright@ 2013 HTML5.com Privacy Policy - About Us
复制代码
步骤4 增加CSS样式
首先创建一个空白的样式,如下:
[/code] 然后在中下载这个css,然后将其内容复制到该空白的文件中代码如下: [code]body {
font-family: arial, sans-serif;
font-size: 100%; /* best for all browser using em */
padding:0;
margin:0;
}
*, html { line-height: 1.6em; }
article img { width:auto; max-width:100%; height:auto; }
.sidebar a, article a, header a, footer a { color: #C30; }
header a { text-decoration: none; }
#wrapper {
font-size: 0.8em; /* 13px from 100% global font-size */
max-width: 960px; /* standard 1024px wide */
margin: 0 auto;
}
/* css for */
header { padding: 1em 0; margin: 0px; float: left; width: 100%;
}
header hgroup { width: 100%; font-weight:normal; }
/* css for */
nav
{ display: block; margin: 0 0 2em; padding: 0px;
float: left; width: 100%; background-color: #181919;
}
nav ul ul {display: none;}
nav ul li:hover ul {display: block;}
nav
ul { padding: 0; list-style: none; position:
relative; display: inline-table; z-index: 9999;
margin: 0px; float: left; width: 100%;
}
nav ul:after {content: ""; clear: both; display: block;}
nav ul li {float: left;}
nav ul li:hover a {color: #fff;}
nav
ul li a { display: block; padding: 1em; font-size:
1.125em; color: #ccc; text-decoration: none;
margin: 0px; background-color: #000; border-right: 1px
solid #333;
}
nav ul li:last-of-type a {border-right: 1px solid transparent !important;}
nav
ul ul { background: #5f6975; border-radius: 0px;
padding: 0; position: absolute; top: 100%; width:
auto; float: none;
}
nav ul li:hover { background: #5f6975; color: #FFF;
}
nav ul ul li a:hover { background-color: #4b545f;
}
nav ul ul li {
float: none;
border-bottom: 1px solid #444240;
position: relative;
}
nav ul ul li a {
padding: 0.5em 1em;
font-size: 1em;
width:10em;
color: #fff;
}
nav ul ul ul {
position: absolute; left: 100%; top:0;
}
/* css for */
section.content { width: 70%; float:left; }
.content article { width:100%; float:left; padding: 0 0 1em; margin: 0 0 1em; border-bottom: 1px solid #ddd; }
article .entry { clear:both; padding: 0 0 1em; }
h1.post-title { font-size: 1.8em; margin:0; padding:0;}
.entry.post-meta { color: #888; }
.entry.post-meta span { padding: 0 1em 0 0; }
.entry.post-content { font-size: 1.125em; margin:0; padding:0;}
/* css for */
aside.sidebar { width: 25%; float:right; }
aside.sidebar ul { width:100%; margin: 0px; padding: 0px; float: left; list-style: none;
}
aside.sidebar
ul li { width:100%; margin: 0px 0px 2em; padding:
0px; float: left; list-style: none;
}
aside.sidebar ul li ul li { margin: 0px 0px 0.2em; padding: 0px;
}
aside.sidebar
ul li ul li ul li { margin: 0px; padding: 0px 0px 0px
1em; width: 90%; font-size: 0.9em;
}
aside.sidebar
ul li h3.widget-title { width:100%; margin: 0px;
padding: 0px; float: left; font-size: 1.45em;
}
/* css for */
footer { width: 98%; float:left; padding: 1%; background-color: white; margin-top: 2em;
}
footer .footer-left { width: 45%; float:left; text-align:left; }
footer .footer-right { width: 45%; float:right; text-align:right; }
复制代码
步骤5 为移动应用使用@media query查询 为了进行响应式设计,最佳的方案是使用@media query去进行查询,在上面的CSS代码中添加如下代码:
/* ipad 768px */
@media only screen and (min-width:470px) and (max-width:770px){
body { background-color: red; } #wrapper { width:96%; font-size: 0.6875em; }
section.content, aside.sidebar { width:100%; }
}
/* iphone 468px */
@media only screen and (min-width:270px) and (max-width:470px){
body { background-color: yellow; } #wrapper { width:96%; font-size: 0.6875em; }
section.content, aside.sidebar { width:100%; }
}
复制代码
步骤6 增加jquery,modernizer和html5shiv到标签中 这里推荐使用Modernizr 和html5shiv,它们都是一个能在多种浏览器中通过运行各种脚本兼容运行支持大部分HTML 5标签的插件。我们将它们和jQuery库放在标签前
CSS中的#sidebar是做什么用的呢
#开头的选择器为id选择器,详细介绍如下:
ID 选择器允许以一种独立于文档元素的方式来指定样式。
在某些方面,ID 选择器类似于类选择器,不过也有一些重要差别。
ID 选择器前面有一个 # 号
请注意,类选择器和 ID 选择器可能是区分大小写的。这取决于文档的语言。HTML 和 XHTML 将类和 ID 值定义为区分大小写,所以类和 ID 值的大小写必须与文档中的相应值匹配。
示例:
#intro {font-weight:bold;}
p id="intro"This is a paragraph of introduction./p
上面的文字会变为粗体
请问大神们,要怎样做一个sidebar浮在html页面上,可以隐藏和显示。谢谢
我猜你要的应该是类似于很多网页的返回顶部,这样浮在页面的
这样是通过设置div的position:fixed来让它浮动到页面的
要隐藏的时候就通过js设置他的display:none;
显示就是:display:block

关于htmlsidebar和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
