Showing posts with label hiding an element - display:none or visibility:hidden. Show all posts
Showing posts with label hiding an element - display:none or visibility:hidden. Show all posts

Wednesday 4 December 2013

CSS : PADDING - INDIVIDUAL SIDES


Padding - Individual sides

In CSS, it is possible to specify different padding for different sides:


Example

CSS : PADDING-SHORTHAND PROPERTY


Padding - Shorthand property

To shorten the code, it is possible to specify all the padding properties in one property. This is called a shorthand property.
The shorthand property for all the padding properties is "padding":


Example

padding:25px 50px;
The padding property can have from one to four values.
  • padding:25px 50px 75px 100px;
    • top padding is 25px
    • right padding is 50px
    • bottom padding is 75px
    • left padding is 100px

  • padding:25px 50px 75px;
    • top padding is 25px
    • right and left paddings are 50px
    • bottom padding is 75px

  • padding:25px 50px;
    • top and bottom paddings are 25px
    • right and left paddings are 50px

  • padding:25px;
    • all four paddings are 25px
 
 

CSS : PADDING PROPERTIES


All CSS Padding Properties


Property
Description
padding
A shorthand property for setting all the padding properties in one declaration
padding-bottom
Sets the bottom padding of an element
padding-left
Sets the left padding of an element
padding-right
Sets the right padding of an element
padding-top
Sets the top padding of an element

CSS : RELATIVE POSITIONING

Relative Positioning
A relative positioned element is positioned relative to its normal position.

Example

h2.pos_left
{
position:relative;
left:-20px;
}
h2.pos_right
{
position:relative;
left:20px;
}

The content of relatively positioned elements can be moved and overlap other elements, but the reserved space for the element is still preserved in the normal flow.

Example

h2.pos_top
{
position:relative;
top:-50px;
}


CSS : NESTING SELECTORS

Nesting Selectors


It is possible to apply a style for a selector within a selector.
In the example below, one style is specified for all p elements, one style is specified for all elements with class="marked", and a third style is specified only for p elements within elements with class="marked":

Example

p
{
color:blue;
text-align:center;
}
.marked
{
background-color:red;
}
.marked p
{
color:white;
}

CSS : GROUPING SELECTORS

Grouping Selectors


In style sheets there are often elements with the same style.

h1
{
color:green;
}
h2
{
color:green;
}
p
{
color:green;
}

To minimize the code, you can group selectors.
Separate each selector with a comma.
In the example below we have grouped the selectors from the code above:

Example

h1,h2,p
{
color:green;
}

CSS : ALL CSS DIMENSION PROPERTIES

All CSS Dimension Properties


The number in the "CSS" column indicates in which CSS version the property is defined (CSS1 or CSS2).

Property
Description
Values
CSS
height
Sets the height of an element
auto
length
%
inherit
1
max-height
Sets the maximum height of an element
none
length
%
inherit
2
max-width
Sets the maximum width of an element
none
length
%
inherit
2
min-height
Sets the minimum height of an element
length
%
inherit
2
min-width
Sets the minimum width of an element
length
%
inherit
2
width
Sets the width of an element
auto
length
%
inherit
1




CSS : Hiding an Element - display:none or visibility:hidden

Hiding an Element - display:none or visibility:hidden

Hiding an element can be done by setting the display property to "none" or the visibility property to "hidden". However, notice that these two methods produce different results:
visibility:hidden hides an element, but it will still take up the same space as before. The element will be hidden, but still affect the layout.


Example

h1.hidden {visibility:hidden;}

display:none hides an element, and it will not take up any space. The element will be hidden, and the page will be displayed as if the element is not there:


Example

h1.hidden {display:none;}

CSS : Display - Block and Inline Elements

CSS Display - Block and Inline Elements

A block element is an element that takes up the full width available, and has a line break before and after it.
Examples of block elements:
  • <h1>
  • <p>
  • <div>
An inline element only takes up as much width as necessary, and does not force line breaks.
Examples of inline elements:
  • <span>
  • <a>

Physics basic inventions and inventors

1.Which instrument is used to measure altitudes in aircraft's ? Audiometer Ammeter Altimeter Anemometer Explanation : ...