border

css border-width percentage

你离开我真会死。 提交于 2019-12-28 18:14:11
问题 I have one div wrapping another like so <div id="container"><div id="box"></div></div> Let's say the container has a dimension 100px by 100px. I want to box to have 0px height and 0px width. However, I want the left border of the box to fill up 50% of the container, and the right border of the box to fill up the the other 50% of the container. How do I do this with css? 回答1: You can do what you are after, but using linear-gradients instead of borders. Use the following markup: <div class="box

CSS Property Border-Color Not Working

北城余情 提交于 2019-12-28 16:34:16
问题 I have issue with border-color. It didn't work. I'm new to css here is the fiddle. http://jsfiddle.net/zeburrehman/aFzKy/151/ <div id="box"> Hello! The color of box border should be red!! </div>​ #box { border-color: red; }​ 回答1: By default the border-width is 0 and border-style is none So you need to set them to border-width:1px and border-style:solid . You can combine all the border properties into one as below: #box { border:1px solid red } 回答2: You need to add the border style: #box {

盒子模型

你说的曾经没有我的故事 提交于 2019-12-28 14:37:54
在css中,每个元素都可以当作一个矩形的盒子。之所以这样是为了更方便布局。把这些元素作为盒子后,我们的布局就相当于在页面中摆放盒子了。 Content内容区 内容区相当于盒子存放东西的空间,位于盒子的最里层。元素的所有子元素都是放在父元素的内容区。 值得注意的是, 当我们指定一个元素的width和height时,其实只是设置了内容区的宽和高。 padding内边距 盒子在内容区周围可能有一层内边距,会影响盒子的大小。内边距是透明的,没有颜色也没有装饰。 盒子一共有四个方向的内边距,分别为padding-top、padding-right、padding-bottom、padding-left。 可以利用上述属性设置单侧内边距,也可以同时设置四个方向的内边距。例如:padding:10px 20px 30px 40px; 表示的是设置上 右 下 左的内边距分别为10px,20px, 30px, 40px。 也可以 padding: 10px 20px 30px; 表示的是上 左右 下 的内边距 也可以 padding:10px 20px; 表示的是上下 左右 的内边距 还可以 padding:10px; 表示的是 上下左右 内边距都为10px. Border边框 边框位于盒子的边缘, 设置边框需要同时设置border-width、border-color、border

Python学习 Day 041 - css 盒模型

陌路散爱 提交于 2019-12-28 14:37:35
主要内容 1.盒模型 2.浮动 1.盒模型 (1)盒模型的属性 width : 内容的宽度 height : 内容的宽度 padding : 内边距,边框到内容的距离 border : 边框,就是指的盒子的宽度 margin : 外边距,盒子边框到附近最近盒子的距离 <title>Title</title> <style> .box{ width: 200px; height:200px; padding:50px; background-color:red; border: 1px solid yellow; margin: 30px; } </style> </head> <body> <div class="box">倚天屠龙记</div> </body> 盒模型代码 (2)盒模型的计算 如果保证盒模型不变,当加padding,就要对盒模型的宽或者高减,保证盒模型的不变 ​ 通过padding能调整子内容的位置,对于padding来说,通常描述的是父子之间的距离 (3)padding(内边距) padding:就是内边距的意思,它是边框到内容之间的距离 另外padding的区域是有背景颜色的。并且背景颜色和内容的颜色一样。也就是说background-color这个属性将填充所有的border以内的区域 padding的设置 <title>Title</title>

CSS基础知识

可紊 提交于 2019-12-28 14:32:41
一、基础知识 1.定义 CSS:层叠样式表,定义如何显示HTML元素。 当浏览器读到一个样式表,它就会按照这个样式表来对文档进行格式化(渲染)。 2.CSS语法 每个CSS样式有两个组成部分:选择器和声明。声明又包括属性和属性值。每个声明之后用分号结束。 3.CSS注释 /*这是注释*/ 4.CSS的几种引入方式 (1)行内样式 行内式是在标记的style属性中设定CSS样式。 <p style="color: red">Hello world.</p> (2)内部样式 嵌入式是将CSS样式集中写在网页的<head></head>标签的<style></style>标签对中。格式如下: <head> <meta charset="UTF-8"> <title>Title</title> <style> p{ background-color: #2b99ff; } </style> </head> (3)外部样式 外部样式就是将CSS写在一个单独的文件中,然后在页面进行引入即可。 <link href="mystyle.css" rel="stylesheet" type="text/css"/> 二、CSS选择器 1.基本选择器 (1)标签选择器 p {color: "red";} (2)ID选择器 #i1 { background-color: red; } (3)类别选择器

web前端基础——CSS

萝らか妹 提交于 2019-12-28 14:24:36
web前端基础——CSS CSS 语法 CSS 规则由两个主要的部分构成:选择器,以及一条或多条声明。 selector { property: value; property: value; ... property: value } 例如 h1 {color:red; font-size:14px;} css的四种引入方式 行内式 行内式是在标记的style属性中设定CSS样式。这种方式没有体现出CSS的优势,不推荐使用。 <head> <meta charset="UTF-8"> <title>Title</title> <style> p{ background-color: #2b99ff; } </style> </head> 嵌入式 嵌入式是将CSS样式集中写在网页的<head></head>标签对的<style></style>标签对中。格式如下: <head> <meta charset="UTF-8"> <title>Title</title> <style> p{ background-color: #2b99ff; } </style> </head> 链接式 将一个.css文件引入到HTML文件中 <link href="mystyle.css" rel="stylesheet" type="text/css"/> 导入式 将一个独立的

祖先、后代、同胞、过滤

房东的猫 提交于 2019-12-28 14:22:23
祖先 : parent parents parentsUntil $ ("div" ).parent ().css ({"border":"2px solid red"} ); $ ("div" ).parents ().css ({"border":"2px solid red"} ); $ ("div" ).parentsUntil ("html" ).css ({"border":"2px solid red"} ); 后代 : children find $ ("div" ).children ().css ({"border":"2px solid red"} ); $ ("body" ).find ("*" ).css ({"border":"2px solid red"} ); 同胞 : sibings next nextAll nextUntil prev prevAll prevUntil $ ("li" ).siblings (".li1" ).css ({"color":"red"} ); 向下 $ ("li" ).next ().css ({"color":"red"} ); $ ("li" ).nextAll ().css ({"color":"red"} ); $ (".b2" ).nextUntil ("h6" ).css ({"color":"red

jquery遍历

非 Y 不嫁゛ 提交于 2019-12-28 14:20:51
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>jquery遍历</title> <script src="../js/jquery-1.8.3.js"></script> <script src="../js/jquery-1.4.2.js"></script> <style> .ancestors * { display: block; border: 2px solid lightgrey; color: lightgrey; padding: 5px; margin: 15px; } </style> <script> /* * 祖先是父、祖父或曾祖父等等。 * 通过 jQuery,您能够向上遍历 DOM 树,以查找元素的祖先。 * * 向上遍历 DOM 树 * 这些 jQuery 方法很有用,它们用于向上遍历 DOM 树: * parent() * parents() * parentsUntil() */ $(document).ready(function(){ /* * jQuery parent() 方法 * parent() 方法返回被选元素的直接父元素。 * 该方法只会向上一级对 DOM 树进行遍历。 * 下面的例子返回每个 <span> 元素的的直接父元素: */ $("span")

How can I achieve a dashed or dotted border in WPF?

十年热恋 提交于 2019-12-28 05:07:06
问题 I have a ListViewItem that I am applying a Style to and I would like to put a dotted grey line as the bottom Border . How can I do this in WPF? I can only see solid color brushes. 回答1: This worked great in our application, allowing us to use a real Border and not mess around with Rectangles: <Border BorderThickness="1,0,1,1"> <Border.BorderBrush> <DrawingBrush Viewport="0,0,8,8" ViewportUnits="Absolute" TileMode="Tile"> <DrawingBrush.Drawing> <DrawingGroup> <GeometryDrawing Brush="Black">

How can I achieve a dashed or dotted border in WPF?

◇◆丶佛笑我妖孽 提交于 2019-12-28 05:07:05
问题 I have a ListViewItem that I am applying a Style to and I would like to put a dotted grey line as the bottom Border . How can I do this in WPF? I can only see solid color brushes. 回答1: This worked great in our application, allowing us to use a real Border and not mess around with Rectangles: <Border BorderThickness="1,0,1,1"> <Border.BorderBrush> <DrawingBrush Viewport="0,0,8,8" ViewportUnits="Absolute" TileMode="Tile"> <DrawingBrush.Drawing> <DrawingGroup> <GeometryDrawing Brush="Black">