非常有用的CSS模板

CSS Reset (CSS固定样板)

/*
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/
/**
 * YUI Reset
 * @module reset
 * @namespace
 * @requires 
 */
html {
    color: #000;
    background: #FFF;
}
body{
    font-size:12px;
}
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, select, p, blockquote, th, td {
    margin: 0;
    padding: 0;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

fieldset,img {
    border: 0;
}

address, button, caption, cite, code, dfn, em, input, optgroup, option, select, strong, textarea, th, var {
    font: inherit;
}

del,ins {
    text-decoration: none;
}

li {
    list-style: none;
}

caption,th {
    text-align: left;
    font-weight:normal;
}

h1,h2,h3,h4,h5,h6 {
    font-size: 100%;
    font-weight: normal;
}

q:before,q:after {
    content: '';
}

abbr,acronym {
    border: 0;
    font-variant: normal;
}

sup {
    vertical-align: baseline;
}

sub {
    vertical-align: baseline;
}

/*because legend doesn't inherit in IE */
legend {
    color: #000;
}

**********辅助css******

/* border */

.bd{border:1px solid #e8e8e8; }
.bdr {border-right: 1px solid #e8e8e8;}
.bdl {border-left: 1px solid #e8e8e8;}
.bdlr{border-left:1px solid #e8e8e8; border-right:1px solid #e8e8e8;}
.bdt{border-top: 1px solid #e8e8e8;}
.bdb {border-bottom: 1px solid #e8e8e8;}
.bdtb{border-top: 1px solid #e8e8e8;border-bottom: 1px solid #e8e8e8;}

/* text-align */
.ta-r{text-align:right;}
.ta-l{text-align:left;}
.ta-c{text-align:center;}

/*float*/
.fl{float:left}
.fr{float:right}
/* padding */
.p{padding:10px;}
.pt{padding-top:10px;}
.pr{padding-right:10px;}
.pb{padding-bottom:10px;}
.pl{padding-left:10px;}
.ptb{padding:10px 0px;}
.plr{padding:0px 10px;}

/* margin */
.m{margin:10px;}
.mt{margin-top:10px;}
.mr{margin-right:10px;}
.mb{margin-bottom:10px;}
.ml{margin-left:10px;}
.mtb{margin:10px 0px;}
.mlr{margin:0px 10px;}

.hide{display:none;}

Browser-Specific CSS Hacks (浏览器特定CSSHacks)

/* IE6 and below */
* html #uno  { color: red }

/* IE7 */
*:first-child+html #dos { color: red } 

/* IE7, FF, Saf, Opera  */
html>body #tres { color: red }

/* IE8, FF, Saf, Opera (Everything but IE 6,7) */
html>/**/body #cuatro { color: red }

/* Opera 9.27 and below, safari 2 */
html:first-child #cinco { color: red }

/* Safari 2-3 */
html[xmlns*=""] body:last-child #seis { color: red }

/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:nth-of-type(1) #siete { color: red }

/* safari 3+, chrome 1+, opera9+, ff 3.5+ */
body:first-of-type #ocho {  color: red }

/* saf3+, chrome1+ */
@media screen and (-webkit-min-device-pixel-ratio:0) {
 #diez  { color: red  }
}

/* iPhone / mobile webkit */
@media screen and (max-device-width: 480px) {
 #veintiseis { color: red  }
}

/* Safari 2 - 3.1 */
html[xmlns*=""]:root #trece  { color: red  }

/* Safari 2 - 3.1, Opera 9.25 */
*|html[xmlns*=""] #catorce { color: red  }

/* Everything but IE6-8 */
:root *> #quince { color: red  }

/* IE7 */
*+html #dieciocho {  color: red }

/* Firefox only. 1+ */
#veinticuatro,  x:-moz-any-link  { color: red }

/* Firefox 3.0+ */
#veinticinco,  x:-moz-any-link, x:default  { color: red  }

/* FF 3.5+ */
body:not(:-moz-handler-blocked) #cuarenta { color: red; }

/* IE6 */
#once { _color: blue }

/* IE6, IE7 */
#doce { *color: blue; /* or #color: blue */ }

/* Everything but IE6 */
#diecisiete { color/**/: blue }

/* IE6, IE7, IE8 */
#diecinueve { color: blue\9; }

/* IE7, IE8 */
#veinte { color/*\**/: blue\9; }

/* IE6, IE7 -- acts as an !important */
#veintesiete { color: blue !ie; } /* string after ! can be anything */

/* IE8, IE9 */
#anotherone  {color: blue\0/;} /* must go at the END of all rules */

A New Micro Clearfix Hack (清除浮动的CSS)

/* For modern browsers */
.cf:before,
.cf:after {
    content:"";
    display:table;
}

.cf:after {
    clear:both;
}

/* For IE 6/7 (trigger hasLayout) */
.cf {
    zoom:1;
}

单行省略号效果

.ellipsis-box {
	text-overflow: ellipsis;
	overflow: hidden;
	white-space: nowrap !important;
	outline: 0 !important
}


Font Sizing (字号设置)

html { font-size: 62.5%; }
body { font-size: 14px; font-size: 1.4rem; } /* =14px */
h1   { font-size: 24px; font-size: 2.4rem; } /* =24px */

The New @Font-Face Syntax (自设字体样式)

@font-face {
	font-family: 'MyFontFamily';
	src: url('myfont-webfont.eot?#iefix') format('embedded-opentype'),
	     url('myfont-webfont.woff') format('woff'),
	     url('myfont-webfont.ttf')  format('truetype'),
	     url('myfont-webfont.svg#svgFontName') format('svg');
}

Target IE set (针对IE的设置)

body {
color: red; /* all browsers, of course */
color : green\9; /* IE8 and below */
*color : yellow; /* IE7 and below */
_color : orange; /* IE6 */
}

Cross-Browser Min Height (跨浏览器的最小高度)

#div {
   min-height: 500px;
   height:auto !important;
   height: 500px;
}

Font Shorthand (字体设置速写)

/*font: font-style font-variant font-weight font-size/line-height font-family;*/
font: italic small-caps bold 15px/30px Helvetica, sans-serif;

IE6/7 Double Margin/Padding Bug (IE6/7双重边距错误)

ul li {
  float: left;
  margin-left: 5px;
  *display: inline; /*IE7 and below*/
  _display: inline; /*IE6 and below*/
}
/* this example fixes double left margin bug 左边距Bug*/

Web Fonts With Google Font API(Google网页字体)

<code><span style="color:#008000;">/* <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Font Name"> */</span>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Tangerine"></code>
<code><span style="color:#008000;">/*CSS selector {  font-family: 'Font Name', serif;}*/
</span>font-family: 'Tangerine', serif;</code>
 

Drop Cap (首字下沉)

p:first-letter {
	display:block;
	margin:5px 0 0 5px;
	float:left;
	color:#FF3366;
	font-size:60px;
	font-family:Georgia;
}

初始化不同长度的input:text和select

	select.smallest{width:126px;}
	select.smaller{width:126px;}
	select.small{width:126px;}
	select.long {width:180px;}
	select.longer {width:276px;/*select 同 input 长度不相同,270+6*/}
	select.longest{width:350px;}

	input.smallest{width:32px; margin-right:20px}
	input.smaller{width:54px;}
	input.small{width:120px;}	
	input.long{width:200px;}
	input.longer{width:270px;}
	input.longest{width:350px;}

布局

.subcolumns { display:table; width:100%; table-layout:fixed; }
.fb {_width: 100%;overflow: hidden;clear: both; }
	.c20l, .c25l, .c33l, .c40l, .c38l, .c50l, .c60l, .c62l, .c66l, .c75l, .c80l { float:left; }
	.c20r, .c25r, .c33r, .c40r, .c38r, .c50r, .c60r, .c66r, .c62r, .c75r, .c80r { float:right; margin-left:-5px; }

	.c20l, .c20r { width:20%; }
	.c40l, .c40r { width:40%; }
	.c60l, .c60r { width:60%; }
	.c80l, .c80r { width:80%; }
	.c25l, .c25r { width:25%; }
	.c33l, .c33r { width:33.333%; }
	.c50l, .c50r { width:50%; }
	.c66l, .c66r { width:66.666%; }
	.c75l, .c75r { width:75%; }
	.c38l, .c38r { width:38.2%; }
	.c62l, .c62r { width:61.8%; }

	/*列间距*/
	.subc  { padding:0 0.5em; }
	.subcl { padding:0 1em 0 0; }
	.subcr { padding:0 0 0 1em; }

/*column-container  
  * @section base layout | Basis Layout
  * @see     http://www.yaml.de/en/documentation/css-components/base-stylesheet.html
  * 
  * |-------------------------------|
  * | #col1   | #col3     | #col2   |
  * | 200 px  | flexible  | 200px   |
  * |-------------------------------|
 */

	.column-container{}
	.column-container .col1 { float:left; width:110px; }
	.column-container .col2 { float:right; width:20%; }
	.column-container .col3 { width:auto; margin:0 0 0 110px; }

form-container

.form-container{}
.form-container .form-container-item{ padding-bottom: 10px; padding-left: 100px; position: relative;min-height:1.5em; }
.form-container .form-container-label{display: block; left: 0;position: absolute; text-align: right; top: 1px;width: 95px; _left:-100px; margin:0}
.form-container .txt-impt, .txt-impt{ color:#D93431; font-weight:bold; padding:0 5px; }
.form-container .colon{ color:#666; font-weight:bold; padding:0 5px; }   /*colon 冒号*/
.form-container textarea{width:500px;height: 67px; padding:2px;}
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 感谢你的兴趣!8套漂亮的HTML CSS网站模板、网页设计源码.zip提供了8种精美的网站模板和相应的源码,它们可以为您的网站提供优雅和专业的外观。 这些模板各有特色,包括不同的颜色方案、布局和样式。它们都使用HTML和CSS编写,因此您可以轻松地自定义和修改它们来适应您的特定需求。 使用这些模板,您可以创建出色的个人简历页面、电子商务网站、企业官方网站等。每个模板都经过精心设计和开发,根据现代网页设计的最佳实践进行了优化。您可以在这些模板中找到响应式设计、无缝导航、交互式元素和各种动画效果。 它们具有清晰的代码结构和易于理解的注释,这使得使用者能够轻松地进行自定义和扩展。如果您是一个开发者或设计师,这些源代码将帮助您更好地理解HTML和CSS的实际应用。 请注意,这些模板仅提供HTML和CSS文件,不包含任何后端功能。如果您需要添加动态功能,例如表单提交或数据库集成,您需要根据您的具体需求自行添加。 总之,8套漂亮的HTML CSS网站模板、网页设计源码.zip将为您提供一些令人惊叹的网站设计方案,并帮助您快速启动您的网站项目。不管您是一个开发者还是一个设计师,这些模板都将为您节省大量的时间和精力。希望这些模板能满足您的需求,祝您的网站项目顺利! ### 回答2: 8套漂亮的HTML CSS网站模板、网页设计源码.zip 是一个包含8种不同风格的网站模板和网页设计源码的压缩文件。这些模板和源码针对不同需求和行业设计,可用于创建漂亮的网站。 这些模板使用HTML和CSS技术开发,所以无需其他复杂的编程知识即可轻松使用。它们提供了一套完整的页面布局和设计元素,包括导航栏、页面标题、主体内容区域和页脚。 通过使用这些模板和源码,用户可以快速启动网站的建设,并根据自己的喜好和需求进行修改。无论是个人网站、企业网站还是博客,这些模板都可以帮助用户创建出独具风格和美感的页面。 使用这些模板还可以节省大量时间和精力,因为它们已经经过精心设计和编码,在视觉上是互补和一致的。用户只需要根据自己的需要进行定制和填充内容,就可以轻松制作出专业、美观且兼容各种设备的网站。 总之,8套漂亮的HTML CSS网站模板、网页设计源码.zip 是一个方便、实用的资源,提供了多种风格的网站模板和源码,可以帮助用户快速搭建漂亮的网站。无论是初学者还是经验丰富的开发者,都可以从这个压缩文件中获得一些有用的网页设计资料。 ### 回答3: 8套漂亮的HTML CSS网站模板、网页设计源码.zip是一个包含了8个精美网站模板的压缩文件。这些模板涵盖了HTML和CSS的设计,可供开发人员和设计师使用。 这些网站模板拥有各自独特的设计风格和布局。它们可以被用于创建各种类型的网站,如企业网站、个人博客、电子商务网站等。每个模板都具有响应式设计,能够适应不同设备(如手机、平板和电脑)上的浏览。 这些模板的设计非常专业,使用了最新的HTML5和CSS3技术,包括动画效果、过渡效果和视觉效果。同时,它们也具备跨浏览器兼容性,能够在各种主流浏览器上正常显示。 使用这些模板,您可以通过简单地替换文本和图片来个性化您的网站内容。您可以自由选择颜色、字体和布局,以满足您网站的需求。同时,这些模板还提供了各种常用网站元素和功能,如导航菜单、图像轮播、表单和社交媒体集成等。 总而言之,8套漂亮的HTML CSS网站模板、网页设计源码.zip为开发人员和设计师提供了一个简单而有效的方式来创建精美的网站。无论您是初学者还是专业人士,这些模板都能为您的网站提供一个高质量的外观和用户体验。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值