1.标准css文件开头怎么写
这就是个风格问题,怎么写都可以。一般来说是重置浏览器有争议的属性,比如边距什么的,再就是设置一些根样式以供其他元素继承,比如body的字体、颜色等,再就是一些公共样式,clearfix清空文档流之类的。当然还有一些高级的技巧,CSS专家也有很多建议,比如《CSS权威指南》作者Eric Meyer的建议是
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
2.如图中的html+css样式应该怎么写
<html>
<head>
<meta charset=utf-8">
<style type="text/css">
.tab{
width: 520px;
height: 25px;
background-color: darkorange;
color: white;
font-family: simhei;
}
td{
width: 50px;
}
</style>
</head>
<body>
<table class="tab" >
<tr>
<td rowspan=3></td>
<td></td>
<td>;首页</td>
<td>;寻找</td>
<td>
<select style="background-color: darkorange;color: #ffffff;font-family: simhei;border: 0">
<option>;场地</option>
<option>;沙滩</option>
<option>;小树林</option>
<option>;别墅里</option>
</select>
</td>
<td>;发布</td>
<td>;需求</td>
</tr>
</table>
</body>
</html>
代码运行图:
如有问题,我们继续交流。
希望能够帮助到你,望采纳!
3.标准css文件开头怎么写
这就是个风格问题,怎么写都可以。
一般来说是重置浏览器有争议的属性,比如边距什么的,再就是设置一些根样式以供其他元素继承,比如body的字体、颜色等,再就是一些公共样式,clearfix清空文档流之类的。当然还有一些高级的技巧,CSS专家也有很多建议,比如《CSS权威指南》作者Eric Meyer的建议是html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary,time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline;}/* HTML5 display-role reset for older browsers */article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block;}body { line-height: 1;}ol, ul { list-style: none;}blockquote, q { quotes: none;}blockquote:before, blockquote:after,q:before, q:after { content: ''; content: none;}table { border-collapse: collapse; border-spacing: 0;}。
4.刚学HTML,但弄不明白CSS样式表该怎么样写烦
一般写法有4种:
<head>
<style type="text/css">
<;!-这是给标签样式-->
body{
font-size:14px;
background-color:#fff;
}
<;!-这是#开头的样式-->
#tab_data{
width: 100%;
border-collapse:collapse;
}
<;!-这是.开头的样式-->
.tad_name{
text-decoration: none;
color: #5394E4;
}
</style>
</head>
调用的时候:
<div class="tad_name"></div><;!-这是.开头的样式的调用-->
<div id="tab_data"></div><;!-这是#开头的样式的调用-->
还有一种叫行类样式:例如:<table style="color:red;"></table>
希望对你有所帮助!望采纳!谢谢!
5.css样式 怎么写
手写了一个例子:
<html>
<head>
<style type="text/css">
.fl {float:left;}
.top .fl {width:28%; text-align:left;background-color:red;}
</style>
</head>
<body>
<div class="top">
<span class="fl">fl</span>
</div>
<br />
<span class="fl">fl</span>
</body>
</html>
效果如图,第一个span是包含在div里的(div 的class为top),为了能看清楚,加了红色的背景。可以看出,红色部分正好是页面宽度的28%(371px/1366px约等于28%)。而第二个,没有包含在div里的span,没有红色背景,显然是不受.top .fl {width:28%; text-align:left;background-color:red;}影响。。。当然咯,你自己测试的时候可以加上.top{***********},体会体会。。。不懂的话,追问咯 ^_^
6.学会怎样给html标签定义css样式
H5edu教育html5开发为您解答:
在HTML中常用以下3种方式定义CSS:Embedding(嵌入式)、Linking(引用式)、Inline(内联式)
一、嵌入式:使用HTML的style元素,在文档中定义CSS样式
<head>
<style type="text/css">
h1{color:red}
p{color:blue}
</style>
<head>
二、内联式 :每一个HTML元素都包含一个style属性,可以直接定义样式。该样式仅能用于该元素的内容,对于另一个同名的元素则不起作用。
<p style="color:#FFF;font-weight:bold;">;内联样式</p>
三、外部引用式:外部引用指HTML文档本身不含有CSS样式,而是动态引用外部的CSS文件定义文档的表现形式。
1、使用样式表的处理指令语句-在HTML文档的开头部分写一个关于样式表的指令处理语句
<?xml-stylesheet type="text/css" href="mystyle.css" ?>
<html>
指令语句
</html>
不过只有使用xml语法格式编写的html文档才支持使用该指令,大多数浏览器仅当被保存为xhtml或xml格式才有效,且JS不能处理这种CSS,所以不建议使用。
2、使用@import命令 -在style元素之间使用@import命令导入外部的css文件
<head>
<style type="text/css">
<;!--下面两行代码效果一样
@import "mystyle.css";
@import url("mystyle.css");
-->
</style>
</head>
任何@import规则必须出现在所有规则之前。参数是一个css文件的URL地址。在一个css文件中也可以用@import指令将另一个css文件导入。
3、使用link元素
<head>
<link rel="stylesheet" href="css的url" type="text/css" >
</head>
这也是最常用的方式。
4、使用HTTP消息报头链接到样式表 -可以使用HTTP消息报头的link字段链接一个外部样式表。 link:<mystyle.css>;rel=stylesheet;
//等同于<link rel="stylesheet" href="css的url" type="text/css" >
HTTP报头中可以使用多个link,从而链接多个样式表,且HTTP报头中的link比HTML文档中的link(head元素中)具有优先级。
7.html select 标签 css 样式怎么写
select 可以定义size就是大小
<style type="text/css">
<!--
.select * {
margin: 0;
padding: 0;
}
.select {
border:1px solid #cccccc;
float: left;
display: inline;
}
.select div {
border:1px solid #f9f9f9;
float: left;
}
/* 子选择器,在FF等非IE浏览器中识别 */
.select>div {
width:120px;
height: 17px;
overflow:hidden;
}
/* 通配选择符,只在IE浏览器中识别 */
* html .select div select {
display:block;
float: left;
margin: -2px;
}
.select div>select {
display:block;
width:124px;
float:none;
margin: -2px;
padding: 0px;
}
.select:hover {
border:1px solid #666666; //鼠标移上的效果
}
.select select>option {
text-indent: 2px; //option在FF等非IE浏览器缩进2px
}
-->
</style>
</head>
<body><div class="select">
<div>
<select>
<option>;看见效果了吧</option>
<option>;看见效果了吧</option>
<option>;看见效果了吧</option>
</select>
</div>
</div>
你看看这段代码中对select的设置
转载请注明出处育才学习网 » htmlcss样式开头怎么写