博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
css points
阅读量:7102 次
发布时间:2019-06-28

本文共 3257 字,大约阅读时间需要 10 分钟。

<style type="text/css" rel="stylesheet">

.a{
width:500px;
height:400px;对放置图片的div区域设置宽和高
border:1px solid red;
}
*{
margin:0px;
padding:0px;
}
</style>
<div class="a">
<img src="oYYBAFWV2zaIKeRmAAEOr_01B-YAACktACESFgAAQ7H134.jpg" border="0px" width="500px" height="400px" />对背景图片本身的宽和高进行设置
</div>

效果如图

<style type="text/css" rel="stylesheet">

p:first-child{匹配第一个p元素
border:1px solid yellow;
}
p>i:first-child{匹配p元素中的第一个i元素
font-weight:bolder;
}
p:first-child i{匹配第一个p元素中的所有元素
color:blue;
}
</style>
</head>
<body>
<p>some <i>text</i>.some <i>text</i>.</p>
<p>some <i>text</i>.some <i>text</i>.</p>
</body>

<style type="text/css" rel="stylesheet">

[title]{
color:yellow;
}
</style>
</head>
<body>
<h1>title属性选择器</h1>
<h2 title="hello">hello</h2>
<a href="http://w3cschool.com" title="w3cschool">w3cschool</a>
</body>

 

<style type="text/css" rel="stylesheet">

[title]{
color:pink;
}
[title=w3cschool]{
border:2px solid red;
}
</style>
</head>
<body>
<h1>title属性选择器</h1>
<h2 title="hello">hello</h2>
<a href="http://w3school.com" title="w3cschool">w3cschool</a>
</body>

 

 

<style type="text/css" rel="stylesheet">

[title~=hello]{title属性中包含hello
color:pink;
}
</style>

<h1>title属性选择器</h1>

<h2 title="this world hello">hello</h2>
<a href="http://w3school.com" title="w3cschool">w3cschool</a>

 

<style type="text/css" rel="stylesheet">

input[type="text"]
{ width:150px;
display:block;
margin-bottom:10px;
background-color:yellow;
font-family: Verdana, Arial;
padding:0px;
}
input[type="button"]{
width:110px;注意按钮实际宽度
margin-left:20px;
display:block;
font-family: Verdana, Arial;
}
</style>
<body>
<form name="input" action="" method="get">
<input type="text" value="name" size="20">
<input type="text" value="password" size="20">
<input type="button" value="提交">

 

 

input元素默认有2px的边框和1px的内补白

此图为按钮的结构图  会发现虽然设置了宽度为110px  但是实际结构中宽度只有94px,需要加上左右边框和内边距才合计为设定的宽度值

 

 

<body>

<form action="" method="post" class="STYLE-NAME">
<h1>Contact Form</h1>
<span id="header">Please fill all the texts in the fields</span>

<hr size=2px width=100% style="margin:0px auto;color:#CCC">size表示分隔线的厚度

<span>Your name:<input type="text" id="name" name="name" placeholder="Your Full Name" /></span>

<span>Your Email:<input type="email" id="email" name="email" placeholder="Vaild Email Adress" /></span>

<span>Message:<textarea id=="message" name="message" cols="20" rows="5" placeholder="Your Message To Us"></textarea></span>

<span>Subject:

  <select name="selection">
     <option value="Job Inquiry">Job Inquiry</option>
     <option value="General Question">General Question</option>
  </select>
</span>

<span>&nbsp;<input type="button" class="button" value="send" /></span>

</form>

</body>

css

@charset "utf-8";

*{
margin:0px;
padding:0px;
}
form{
width:500px;
height:350px;
background-image:url(1.jpg);
background-repeat:no-repeat;;
background-position:top left;
background-attachment:fixed;需要改变背景图片的大小
padding:0px;
margin:10px auto;
}
h1{
margin-top:5px;
margin-left:20px;
}
#header{
display:block;
font-size:12px;
margin:1px auto 20px 20px;
font-weight:bold;
}
span{
display:block;
margin:15px;
margin-left:100px;
font-weight:bold;
}
input{
width:200px;
}
input[type="button"]{
width:70px;
height:40px;
margin:5px auto;
}

效果图

 

转载于:https://www.cnblogs.com/zhongyudengdaoyinghuahuimou/p/6860570.html

你可能感兴趣的文章
PHP服务器端API原理及示例讲解(接口开发)
查看>>
erlang遍历目录
查看>>
Stanford CS231n实践笔记(课时14卷积神经网络详解 上)
查看>>
文章标题
查看>>
MQ与webservice的区别,MQ的区别
查看>>
JS实现图片base64转blob对象,压缩图片,预览图片,图片旋转到正确角度
查看>>
『TensorFlow』生成式网络中的图片预处理
查看>>
译:7.使用Spring MVC服务Web内容
查看>>
【Windows】cmd条件判断
查看>>
图解Elasticsearch中的_source、_all、store和index属性
查看>>
Servlet路径跳转问题
查看>>
MySQL 单个表锁死 对查询语句无响应
查看>>
前端插件资源
查看>>
C# new和初始化
查看>>
多个方面比较电路交换、报文交换和分组交换的主要优缺点
查看>>
CentOS7 Failed to start LSB: Bring up/down解决方法
查看>>
【java】java中替换中括号[ ]操作
查看>>
重看计算机基础1:数据线、地址线,按字、按字节寻址。
查看>>
oracle 11g亿级复杂SQL优化一例(数量级性能提升)
查看>>
Qt Md5应用示例
查看>>