Home > Web Front-end > HTML Tutorial > 关于border边框内偏移的css方法_html/css_WEB-ITnose

关于border边框内偏移的css方法_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:13:22
Original
3742 people have browsed it

如图:
1有左边框白色的。
2白色左边框往蓝色里面移动几十像素
请问用css怎么才能达到2的效果呢?
我1是用的border-left:1px #fff solid;
但是不知道如何将边框往内移进去


回复讨论(解决方案)

用div定一条线

2个div么

一个是蓝色背景 里面一个是带边框线的div

或者一个div  背景图片就是 白线  控制白线定位就可以了

<!doctype html><html lang="en"><head>	<meta charset="UTF-8">	<title>页面名称</title><style type="text/css">#box {	width: 200px;	height: 100px;	background-color: #00f;}#box:before {	content: "";	display: block;	height: 100%;	margin-left: 50px;	border-left: 1px solid #ff0;}</style></head><body><div id="box"></div></body></html>
Copy after login

用margin-left就行啊 ,将整个div{ margin-left:10px;}

3楼的方法很省事,CSS3的
还可以在其中加一个元素,白色,1像素.绝对定位

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template