Top Banner
1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)
27

1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

Dec 23, 2015

Download

Documents

Blanche Parks
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

1

CS428 Web EngineeringLecture 10

Images, Tables, Forms, Border-Radius(CSS – V)

Page 2: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

CSS Images• CSS play a good role to control image

display, you can set following image properties:

The border property is used to set the border of an image.

The height property is used to set the height of an image.

The width property is used to set the width of an image.

The opacity property is used to set the opacity of an image.

Page 3: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

3

border• <img style=“border: 4pt dashed red;”

src=“images/css.gif” />

• Output:

• Possible values:

can have a value in length or in %, pt, px

Page 4: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

4

height• <img style=“border: 1pt solid red;

height: 200px;”

src=“images/css.gif” />

• Output:

• Possible values:

%, pt, px

Page 5: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

5

width• <img style=“border: 1pt solid red;

width: 200px;”

src=“images/css.gif” />

• Output:

• Possible values:

%, pt, px

Page 6: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

opacity• The opacity property is used to create

transparency of an element or an image.

• The opacity value is a floating point number from 0.0 to 1.0.

• A lower value makes element more transparent.

• The opacity value of 0 defines the element as fully transparent.

Page 7: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

Example• <style>

img {opacity: 0.4;

}</style><img src=“flower.jpg” alt=“” title=“” />

Page 8: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

8

• Regular Image:

• The same image with transparency:

Page 9: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

Rounded Corners: border-radius

• The border radius property lets you create rounded corners.

• <style>#box1 {

border: 2px solid red;width: 150px;height: 70px;border-radius: 25px;

}</style><div id=“box1”>HTML5 & CSS3</div>

Page 10: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

10

Page 11: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

11

border-top-left-radius• <style>

#box1 {

border: 2px solid red;

width: 150px;

height: 70px;

border-top-left-radius: 5px;

}

</style>

<div id=“box1”>HTML5 & CSS3</div>

• Output:

• Possible values:

number in pixels

Page 12: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

12

border-top-right-radius• <style>

#box1 {

border: 2px solid red;

width: 150px;

height: 70px;

border-top-right-radius: 10px;

}

</style>

<div id=“box1”>HTML5 & CSS3</div>

• Output:

• Possible values:

number in pixels

Page 13: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

13

border-bottom-right-radius• <style>

#box1 {

border: 2px solid red;

width: 150px;

height: 70px;

border-bottom-right-radius: 15px;

}

</style>

<div id=“box1”>HTML5 & CSS3</div>

• Output:

• Possible values:

number in pixels

Page 14: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

14

border-bottom-left-radius• <style>

#box1 {

border: 2px solid red;

width: 150px;

height: 70px;

border-bottom-left-radius: 40px;

}

</style>

<div id=“box1”>HTML5 & CSS3</div>

• Output:

• Possible values:

number in pixels

Page 15: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

15

Forms: input[type=control]

• You can also change the form appearance.

• Input[type=control] is used to change the default form appearance.

Page 16: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

16

input[type=submit]• <style>

input[type=submit] {

color: #FF00CC;

background-color: blue;

border-radius: 10px;

font-weight: bold;

}

</style>

• Output:

Page 17: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

CSS Tables• You can set following table properties:

The border property is used to set the border of a table.

The border-collapse property sets whether the table borders are collapsed into a single border or separated.

The width property is used to set the width of a table.

The height property is used to set the height of a table.

Page 18: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

18

– The text-align property is set the horizontal alignment.

– The vertical-align property is set the vertical alignment.

– The padding property is used to control the border and contents in a table.

– The color property is set the text color.– The background-color property is set the

background color of a table.

Page 19: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

19

border• <style>

table, th, td {

border: 1px solid black;

}

</style>• <table >

<tr>

<th>Comany</th><th>Country</th>

</tr>

<tr>

<td>The Big Cheeze</td> <td>USA</td>

</tr>

<tr>

<td>Island Trading</td> <td>UK</td>

</tr>

</table>

Page 20: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

20

border-collapse property• The border-collapse property sets whether

the table borders are collapsed into a single border or separated:

• Possible values: collapse, separate

Page 21: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

21

border-collapse• <style>

table {

border-collapse: collapse; }

table, th, td {

border: 1px solid black; }

</style>• <table >

<tr>

<th>Comany</th><th>Country</th>

</tr>

<tr>

<td>The Big Cheeze</td><td>USA</td>

</tr>

<tr>

<td>Island Trading</td><td>UK</td>

</tr>

</table>

Page 22: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

22

width & height property

• <style>

table {

width: 50%;

}

th {

height: 50px;

}

</style>

Page 23: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

text-align• <style>

table {

width: 50%;

}

td {

text-align: right;

}

</style>

Page 24: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

vertical-align• <style>

table {

width: 50%;

}

td {

height: 50px;

vertical-align: middle;

}

</style>

Page 25: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

padding• <style>

table {

width: 50%;

}

th {

height: 50px;

padding: 15px;

}

</style>

Page 26: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

color• <style>

table {

width: 50%;

}

th {

height: 50px;

background-color: green;

color: white;

}

</style>

Page 27: 1 CS428 Web Engineering Lecture 10 Images, Tables, Forms, Border-Radius (CSS – V)

caption-side• <style>

table {

caption-side: bottom;

}

th {

height: 50px;

background-color: green;

color: white;

}

</style>

• Possible values: left, right, top and bottom