One of the main reasons why designers use images on a Web page is to create curves and round corners. It's currently impossible to create any kind of curved shapes using pure HTML, so images need to be applied.
The problem? Putting these images into an HTML document with a table layout can create a large amount of superfluous code. In this tutorial, we'll use CSS to create this box with round corners, without an tag in sight!
How it Works
The above is basically a normal box that has an orange background colour, over which four corner images are superimposed. All these images have been called up through CSS commands.
So, we start off with the following snippet:
Lorem ipsum dolor sit amet consectetur adipisicing elit
We've used class="bl" as we're going to assign our bottom right corner to this
through a CSS command. As a rule, you can only assign one background image to an HTML tag using CSS, so this is the only image we'll assign to this
The CSS background command is broken into three sections: the image URL, its position, and a repeat command. We also inserted a width CSS command so that the box doesn't cover the whole of the screen. Let's examine the three background commands in turn:
Image URL - Remember, the image is being called through the CSS, so the path to the image must be the path from the CSS document, not the HTML document.
Image Position - In this example, we've used the command 0 100% in our CSS rule. The first number represents the distance from the left edge of the
; the second number identifies the distance from the top edge. In this instance % was used, but a different distance value, such as em or px, could just as easily have been used instead. If this command was left out, the default value, 0 0, would be used, and the image would be placed in the top-left corner.
Repeat Command – Obviously, we don't want this image to repeat, so we insert the no-repeat CSS command. If we wanted to, we could have used repeat-x, to repeat the image horizontally, repeat-y, to repeat it vertically, and repeat to repeat it both horizontally and vertically. If this command was left out, the default value, repeat, would be used.
It doesn't matter in which order these three CSS background commands are placed. Our box with curves now looks like this.
Bottom-Right Curve
Next, we'll stick in that bottom-right curve. As previously mentioned, we can only assign one background image to each
in the CSS, so we'll need to insert a new
:
Lorem ipsum dolor sit amet consectetur adipisicing elit
Here's the image we'll use:
Naming this bottom-right image br.gif, we'll insert a new CSS rule:
.br {background: url(br.gif) 100% 100% no-repeat}
This CSS rule is essentially the same as the last one, although now we've changed the position from the left to 100%, where previously it was 0%. The box now looks like this.
Top Curves
To make our top curves, we'll need two new images:
We'll call these tl.gif and tr.gif. We'll need to create two new
s for them:
Lorem ipsum dolor sit amet consectetur adipisicing elit
We'll now insert our orange background colour into the box, in order to achieve the whole round corners effects.
The background colour must always be assigned to the very first CSS rule. This is because each CSS background rule is essentially a layer on top of the previous one. So, in this example, we have a layering order of br.gif, bl.gif, tl.gif and then tr.gif. But, in this example, the images don't overlap, so we don't really notice this layering effect.
By default, a background colour covers the entire
and will layer on top of any other previously assigned background images and/or colours. Therefore, if we place the orange colour in any
other than the first, it will be placed on top of the preceding images and will essentially cause them to disappear. Therefore, we must place our orange background colour (#e68200) in the very first CSS rule:
As before, it doesn't matter where we place this colour command within the CSS background rule. Our box now looks like this.
Padding
Padding is needed to prevent the text from overlapping on to the images, which are 10px x 10px in size. Therefore, we need 10px-worth of padding on the text. But to which
should we assign the padding CSS rule? Does it matter? Well, yes it does.
Whichever element we assign padding to, each of the elements inside it will inherit that padding. If we were to assign padding to the very first
,
, we'd get this effect.
To get this padding to work properly, we need to assign it to the very last
You may have noticed the bottom corners were called up before the top corners. If we were to do things the other way round, that is, call the top corners first, some parts of the orange background colour would sneak out under the bottom curves, causing a rather unsightly effect. Switch the order of the
s around and see for yourself.
Another issue in Internet Explorer is that the background colour of the box sometimes overlaps on to the element below, again causing an unattractive effect. This can be solved simply by placing a tiny placeholder beneath the box with round corners. Immediately after the fourth closing
, insert the following HTML:
Now, assign it this CSS rule:
.clear {font-size: 1px; height: 1px}
The Final Code
Our finished HTML now looks like this:
Lorem ipsum dolor sit amet consectetur adipisicing elit
androi中提到了布尔数组;
布尔数组默认的是false, 并且只会打印false或者是true
布尔数组的例子; 根据字符数组创建布尔数组
char[] c = {'p','u','b','l','i','c'};
//根据字符数组的长度创建布尔数组的个数
boolean[] b = new bool
文章摘自:http://blog.csdn.net/yangwawa19870921/article/details/7553181
在编写HQL时,可能会出现这种代码:
select a.name,b.age from TableA a left join TableB b on a.id=b.id
如果这是HQL,那么这段代码就是错误的,因为HQL不支持
1. 简单的for循环
public static void main(String[] args) {
for (int i = 1, y = i + 10; i < 5 && y < 12; i++, y = i * 2) {
System.err.println("i=" + i + " y="
异常信息本地化
Spring Security支持将展现给终端用户看的异常信息本地化,这些信息包括认证失败、访问被拒绝等。而对于展现给开发者看的异常信息和日志信息(如配置错误)则是不能够进行本地化的,它们是以英文硬编码在Spring Security的代码中的。在Spring-Security-core-x
近来工作中遇到这样的两个需求
1. 给个Date对象,找出该时间所在月的第一天和最后一天
2. 给个Date对象,找出该时间所在周的第一天和最后一天
需求1中的找月第一天很简单,我记得api中有setDate方法可以使用
使用setDate方法前,先看看getDate
var date = new Date();
console.log(date);
// Sat J
MyBatis的update元素的用法与insert元素基本相同,因此本篇不打算重复了。本篇仅记录批量update操作的
sql语句,懂得SQL语句,那么MyBatis部分的操作就简单了。 注意:下列批量更新语句都是作为一个事务整体执行,要不全部成功,要不全部回滚。
MSSQL的SQL语句
WITH R AS(
SELECT 'John' as name, 18 as