Showing posts with label CSS. Show all posts
Showing posts with label CSS. Show all posts

What is a Client?

0 comments
The 'client' is used in client-server environment to refer to the program the person uses to run the application. A client-server environment is one in which multiple computers share information such as entering information into a database. The 'client' is the application used to enter the information, and the 'server' is the application used to store the information.
Continue Reading...

All CSS Border Properties and their descriptions

0 comments
  1. border: Sets all the border properties in one declaration
  2. border-bottom: Sets all the bottom border properties in one declaration
  3. border-bottom-color: Sets the color of the bottom border
  4. border-bottom-style: Sets the style of the bottom border
  5. border-bottom-width: Sets the width of the bottom border
  6. border-color: Sets the color of the four borders
  7. border-left: Sets all the left border properties in one declaration
  8. border-left-color: Sets the color of the left border
  9. border-left-style: Sets the style of the left border
  10. border-left-width: Sets the width of the left border
  11. border-right: Sets all the right border properties in one declaration
  12. border-right-color: Sets the color of the right border
  13. border-right-style: Sets the style of the right border
  14. border-right-width: Sets the width of the right border
  15. border-style:Sets the style of the four borders
  16. border-top: Sets all the top border properties in one declaration
  17. border-top-color: Sets the color of the top border
  18. border-top-style: Sets the style of the top border
  19. border-top-width: Sets the width of the top border
  20. border-width: Sets the width of the four borders
Continue Reading...

CSS Border - Shorthand property

2 comments
There are many properties to consider when dealing with borders. To shorten the code, it is also possible to specify all the border properties in one property. This is called a shorthand property.The shorthand property for the border properties is "border":

Example
border:5px solid red;

When using the border property, the order of the values are:

  • border-width
  • border-style
  • border-color

It does not matter if one of the values above are missing (although, border-style is required), as long as the rest are in the specified order.
Continue Reading...

CSS Border Color property

0 comments
The border-color property is used to set the color of the border. The color can be set by:

  1. name - specify a color name, like "red"
  2. RGB - specify a RGB value, like "rgb(255,0,0)"
  3. Hex - specify a hex value, like "#ff0000"

You can also set the border color to "transparent".

Note: The "border-color" property does not work if it is used alone. Use the "border-style" property to set the borders first.


Example
p.one
{
border-style:solid;
border-color:red;
}
p.two
{
border-style:solid;
border-color:#98bf21;
}
Continue Reading...

CSS Border Width property

0 comments
The border-width property is used to set the width of the border. The width is set in pixels, or by using one of the three pre-defined values: thin, medium, or thick.

Note: The "border-width" property does not work if it is used alone. Use the "border-style" property to set the borders first.


Example
p.one
{
border-style:solid;
border-width:5px;
}
p.two
{
border-style:solid;
border-width:medium;
}
Continue Reading...

CSS Border Style property

0 comments
The border-style property specifies what kind of border to display.
border-style values:

  • none: Defines no border
  • dotted: Defines a dotted border
  • dashed: Defines a dashed border
  • solid: Defines a solid border
  • double: Defines two borders. The width of the two borders are the same as the border-width value
  • groove: Defines a 3D grooved border. The effect depends on the border-color value
  • ridge: Defines a 3D ridged border. The effect depends on the border-color value
  • inset: Defines a 3D inset border. The effect depends on the border-color value
  • outset: Defines a 3D outset border. The effect depends on the border-color value

Tip: None of the border properties will have any effect unless the border-style property is set!
Continue Reading...

CSS Tables properties

0 comments

Table Borders

To specify table borders in CSS, use the border property.

Example
table, th, td
{
border: 1px solid black;
}

Notice that the table in the example above has double borders. This is because both the table, th, and td elements have separate borders.

Collapse Borders

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

Example
table
{
border-collapse:collapse;
}
table,th, td
{
border: 1px solid black;
}

Table Width and Height

Width and height of a table is defined by the width and height properties.

Example
table
{
width:100%;
}
th
{
height:50px;
}

Table Text Alignment

The text in a table is aligned with the text-align and vertical-align properties. The text-align property sets the horizontal alignment, like left, right, or center:

Example
td
{
text-align:right;
}

The vertical-align property sets the vertical alignment, like top, bottom, or middle:

Example
td
{
height:50px;
vertical-align:bottom;
}

Table Padding

To control the space between the border and content in a table, use the padding property on td and th elements:

Example
td
{
padding:15px;
}

Table Color

The example below specifies the color of the borders, and the text and background color of th elements:

Example
table, td, th
{
border:1px solid green;
}
th
{
background-color:green;
color:white;
}
Continue Reading...

All CSS List Properties

0 comments
PropertyDescription
list-style
Sets all the properties for a list in one declaration
list-style-image
Specifies an image as the list-item marker
list-style-position
Specifies if the list-item markers should appear inside or outside the content flow
list-style-type
Specifies the type of list-item marker
Continue Reading...

The CSS Lists properties

0 comments
In HTML, there are two types of lists:
  1. unordered lists - the list items are marked with bullets
  2. ordered lists - the list items are marked with numbers or letters
The CSS list properties allow you to:
  • Set different list item markers for ordered lists
  • Set different list item markers for unordered lists
  • Set an image as the list item marker
Different List Item Markers
The type of list item marker is specified with the list-style-type property:

Example
ul.a {list-style-type: circle;}
ul.b {list-style-type: square;}

ol.c {list-style-type: upper-roman;}
ol.d {list-style-type:lower-alpha;}

An Image as The List Item Marker

To specify an image as the list item marker, use the list-style-image property.

Example:
ul
{
list-style-image: url('sqpurple.gif');
}

Note: The example above does not display equally in all browsers. IE and Opera will display the image-marker a little bit higher than Firefox, Chrome, and Safari.

If you want the image-marker to be placed equally in all browsers, a crossbrowser solution is explained below.

Crossbrowser Solution

The following example displays the image-marker equally in all browsers:

Example
ul
{
list-style-type: none;
padding: 0px;
margin: 0px;
}
li
{
background-image: url(sqpurple.gif);
background-repeat: no-repeat;
background-position: 0px 5px;
padding-left: 14px;
}

Explaination for above example:
  • For ul:
    • Set the list-style-type to none to remove the list item marker
    • Set both padding and margin to 0px (for cross-browser compatibility)
  • For li:
    • Set the URL of the image, and show it only once (no-repeat)
    • Position the image where you want it (left 0px and down 5px)
    • Position the text in the list with padding-left

List - Shorthand property

It is also possible to specify all the list properties in one, single property. This is called a shorthand property. The shorthand property used for lists, is the list-style property:
Example
ul
{
list-style: square url("sqpurple.gif");
}

Note: When using the shorthand property, the order of the values are:
  • list-style-type
  • list-style-position (for a description, see the CSS properties table below)
  • list-style-image


Tip: It does not matter if one of the values above are missing, as long as the rest are in the specified order.
Continue Reading...

CSS Links and Link Styles

0 comments
Links can be styled with any CSS property (e.g. color, font-family, background, etc.). Special for links are that they can be styled differently depending on what state they are in.

The four links states are:

  • a:link - a normal, unvisited link
  • a:visited - a link the user has visited
  • a:hover - a link when the user mouses over it
  • a:active - a link the moment it is clicked

Example
a:link {color:#FF0000;} /* unvisited link */
a:visited {color:#00FF00;} /* visited link */
a:hover {color:#FF00FF;} /* mouse over link */
a:active {color:#0000FF;} /* selected link */

Note: When setting the style for several link states, there are some order rules:

  • a:hover MUST come after a:link and a:visited
  • a:active MUST come after a:hover

Common Link Styles

In the example above the link changes color depending on what state it is in. Lets go through some of the other common ways to style links:

Text Decoration
The text-decoration property is mostly used to remove underlines from links:
Example
a:link {text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}
a:active {text-decoration:underline;}

Background Color
The background-color property specifies the background color for links.
Example
a:link {background-color:#B2FF99;}
a:visited {background-color:#FFFF85;}
a:hover {background-color:#FF704D;}
a:active {background-color:#FF704D;}
Continue Reading...

All CSS Font Properties

0 comments
PropertyDescriptionValues
fontSets all the font properties in one declarationfont-style
font-variant
font-weight
font-size
font-family
caption
icon
menu
message-box
small-caption
status-bar
inherit
font-family
Specifies the font family for text
font-name
generic-family
inherit
font-size
Specifies the font size of text
xxx-small
x-small
small
medium
large
x-large
xx-large
smaller
larger
%
inherit
font-style
Specifies the font style for text
normal
italic
oblique
inherit
font-variant
Specifies whether or not a text should be displayed in a small caps
normal
small-caps
inherit
font-weight
Specifies the weight of a font
normal
bold
bolder
lighter
inherit
Continue Reading...

CSS Styling Fonts

0 comments
CSS font properties define the font family, boldness, size, and the style of a text. In CSS, there are two types of font family names:
  1. generic family - a group of font families with a similar look (like "Serif" or "Monospace")
  2. font family - a specific font family (like "Times New Roman" or "Arial")

Font Family

The font family of a text is set with the font-family property.

The font-family property should hold several font names as a "fallback" system. If the browser does not support the first font, it tries the next font.Start with the font you want, and end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available. More than one font family is specified in a comma-separated list:

Example:
  • p{font-family:"Times New Roman", Times, serif;}

Note: If the name of a font family is more than one word, it must be in quotation marks, like font-family: "Times New Roman".


Tip: On computer screens, sans-serif fonts are considered easier to read than serif fonts.

Font Style

The font-style property is mostly used to specify italic text. This property has three values:
  1. normal - The text is shown normally
  2. italic - The text is shown in italics
  3. oblique - The text is "leaning" (oblique is very similar to italic, but less supported)

Example:
  1. p.normal {font-style:normal;}
  2. p.italic {font-style:italic;}
  3. p.oblique {font-style:oblique;}
Font Size

The font-size property sets the size of the text. The font-size value can be an absolute, or relative size.

Absolute size:

  • Sets the text to a specified size
  • Does not allow a user to change the text size in all browsers (bad for accessibility reasons)
  • Absolute size is useful when the physical size of the output is known

Relative size:

  • Sets the size relative to surrounding elements
  • Allows a user to change the text size in browsers
Continue Reading...

All CSS Text Properties

0 comments
PropertyDescriptionValues
color
Sets the color of text
color
direction
Specifies the text direction/writing direction
ltr,
rtl
letter-spacing
Increases or decreases the space between characters in a text

line-height
Sets the line height
normal,
number,
length,
%
text-align
Specifies the horizontal alignment of text
left,
right,
center,
justify
text-decoration
Specifies the decoration added to text
none,
underline,
overline,
line-through,
blink
text-indent
Specifies the indentation of the first line in a text-block
length,
%
text-shadowSpecifies the shadow effect added to textnone,
color,
length
text-transform
Controls the capitalization of text
none,
capitalize,
uppercase,
lowercase
vertical-align
Sets the vertical alignment of an element
baseline,
sub,
super,
top,
text-top,
middle,
bottom,
text-bottom,
length,
%
white-space
Specifies how white-space inside an element is handled
normal,
pre,
nowrap
word-spacing
Increases or decreases the space between words in a text
normal,
length
Continue Reading...

CSS Text

0 comments

Text Color

The color property is used to set the color of the text. The color property is most often specified by:
  • a HEX value - like "#ff0000"
  • an RGB value - like "rgb(255,0,0)"
  • a color name - like "red"

Example:
body {color:navy;}
h1 {color:#00ff00;}
p {color:rgb(255,0,0);}

Text Alignment

The text-align property is used to set the horizontal alignment of a text. The Text can be centered, or aligned to the left or right, or justified.

Example:
p.date {text-align:right;}
p.main {text-align:justify;}

Text Decoration

The text-decoration property is used to set or remove decorations from text.

Tip: The text-decoration property is mostly used to remove underlines from links for design purposes.

Example:
a {text-decoration:none;}

Text Transformation

The text-transform property is used to specify uppercase and lowercase letters in a text. It can be used to turn everything into uppercase or lowercase letters, or capitalize the first letter of each word.

Example:
p.uppercase {text-transform:uppercase;}
p.lowercase {text-transform:lowercase;}
p.capitalize {text-transform:capitalize;}

Text Indentation

The text-indentation property is used to specify the indentation of the first line of a text.

Eample:
p {text-indent:50px;}
Continue Reading...

All CSS background properties and values

0 comments

PropertyDescriptionValues
background
Sets all the background properties in one declaration
background-color
background-image
background-repeat
background-attachment
background-position
inherit
background-attachment
Sets whether a background image is fixed or scrolls with the rest of the page
scroll
fixed
inherit
background-color
Sets the background color of an element
color
transparent
inherit
background-image
Sets the background image for an element
url(URL)
none
inherit
background-position
Sets the starting position of a background image
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
x-pos y-pos
inherit
background-repeat
Sets how a background image will be repeated
repeat
repeat-x
repeat-y
no-repeat
inherit
Continue Reading...

Background property in CSS

0 comments
CSS background properties are used to define the background effects of an element.CSS properties used for background effects:
  1. background-color
  2. background-image
  3. background-repeat
  4. background-attachment
  5. background-position

Note:
When using the shorthand property the order of the property values are:
  1. background-color
  2. background-image
  3. background-repeat
  4. background-attachment
  5. background-position


It does not matter if one of the property values is missing, as long as the ones that are present are in this order.
Continue Reading...

What style will be used when there is more than one style specified for an HTML element?

0 comments
If some properties have been set for the same selector in different style sheets, the values will be inherited from the more specific style sheet.

Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority:

  1. Browser default
  2. External style sheet
  3. Internal style sheet (in the head section)
  4. Inline style (inside an HTML element)

So, an inline style (inside an HTML element) has the highest priority, which means that it will override a style defined inside the <head> tag, or in an external style sheet, or in a browser (a default value).
Continue Reading...

How can we insert a style sheet?

0 comments
There are three ways of inserting a style sheet. They are...
  1. External style sheet
  2. Internal style sheet
  3. Inline style

External Style Sheet
An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look of an entire Web site by changing one file. An external style sheet can be written in any text editor. The file should not contain any html tags. Your style sheet should be saved with a .css extension.

Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section. The syntax for linking an external style sheet goes:

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
</head>

Internal Style Sheet
An internal style sheet should be used when a single document has a unique style. You define internal styles in the head section of an HTML page, by using the <style> tag, like this:
<head>
<style type="text/css">
h1 {color:navy;}
p {margin-left:20px;text-align:justify;}
</style>
</head>

Inline Styles
To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property.

    example:
<p style="color:navy;margin-left:20px">
This is a sample paragraph.
</p>
Continue Reading...

The id and class Selectors in CSS

0 comments
To set a style for a HTML element, CSS allows you to specify your own selectors called

  1. id selector and
  2. class Sselector


The id Selector:
The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#".

The class Selector:
The class selector is used to specify a style for a group of elements. This allows you to set a particular style for many HTML elements with the same class.The class selector uses the HTML class attribute, and is defined with a "."

Unlike the id selector, the class selector is most often used on several elements.
Continue Reading...

Comments in CSS

0 comments
The CSS comments are ignored by browsers. Comments are used to explain your code, and may help you when you edit the source code at a later date.

CSS comment begins with "/*", and ends with "*/".

Example:
    /*This is a CSS comment*/
Continue Reading...
> Related Posts with Thumbnails
 

Copyright © 2012. GS dot net - All Rights Reserved - Design by BTDesigner - Proudly powered by Blogger