CSS Properties

Commonly used CSS properties

Style creation with css is done by giving value to css properties. In the table below, the most important css features and the values ​​they can take are mentioned.

 

Background Properties
background-color It determines the background color, color name or color code is entered.
background-image

Used for background image.

background-image: url(images/bg.jpg);

background-repeat

In which directions the background image will be tiled and repeated.

Repeat-x, repeat-y, no-repeat, repeat

background-position Laying the background image within the page, where to start. Like center center, top center…
background- attachment How the background image moves with the page. If we do Fixed, it will be fixed and the picture will not slide even if the page slides.

 

Font and Text Properties
color

Sets the text color. Color name or color code is entered.

color: red;

color: #999;

color: rgb(255, 255, 255);

font-family

Sets the font.

font-family: Arial;

font-size

Sets the font size (px, pt, em).

font-size: 10pt;

font-weight Text can be made bold or normal. bold, normal...
font-style The text can be italic or normal. italic, normal…
line-height Sets the spacing between lines. e.g. 10px…
text-align Sets the text horizontal alignment (left, right, center)
text-decoration

Draws a line below, above, or above the text.

underline to underline, none to remove the line

text-indent

Sets the indent of the first line of the paragraph.

text-indent:15px;

letter-spacing

Sets the character spacing.

letter-spacing: 5px;

word-spacing Sets the spacing between words.
vertical-align Adjusts the vertical alignment.

 

Inner and Outer Space
margin

Outer space around an element.

margin:5px;

When we use it this way, the same amount of space is left from all directions. If we just want to set space from the bottom, top, left or right, we can use it as follows:

margin-top 

margin-right (right margin) 

margin-bottom 

margin-left (left margin) 

padding

The inner space of an element. (inside the borders)

padding: 5px;

When we use it this way, the same amount of space is left from all directions . If we just want to set space from the bottom, top, left or right, we can use it as follows:

padding-top (top margin) 

padding-right (right margin) 

padding-bottom (bottom margin) 

padding-left (left margin) 

 

Border Properties
border-style

We can set the border style. Like solid, dotted, dashed. If we just want to set the left, right, bottom or top border style, we can use the following properties:

border-top-style     

border-right-style  

border-bottom-style  

border-left-style

border-width

We can set the border thickness. If we just want to adjust the left, right, bottom or top border thickness, we can use the following properties:

border-top-width  

border-right-width  

border-bottom-width  

border-left-width 

border-color

We can set the border color. If we just want to adjust the left, right, bottom or top border thickness, we can use the following properties:

border-top-color   

border-right-color  

border-bottom-color   

border-left-color 

border

border: 2px dotted #022163;

The thickness, style and color of the border can be determined in a single line.

border-collapse

border-collapse:collapse;

By using the as above, cells can be removed from their lines. That is, table borders consist of one line instead of two lines.

 

Boxes and Layouts
Detailed informations are at the next pages.
float

It is especially used for div elements. Div elements are normally placed one after the other. We can place it as we want by setting the float properties to “left, right”.

float:left;

float:right;

clear

It ensures that the div element to which it is applied and the div elements that follow it continue to be placed as normal, and are not affected by the float properties applied to the previous divs. For this, the clear property is used as follows:

clear:both;

display

HTML tags are divided into inline and block elements. Block elements are placed one below the other on the page. That is, the tags after that element continue from the bottom line. For example, after tags such as table, h1, p, div, the bottom line is passed.

Inline elements are placed inline. For example, tags such as b, i, u , a, font continue from the same line. These properties of the desired tags can be changed as follows:

display:block;

display:inline ;

 

List Properties
list-style-type

In lists created with ol or ul, we use it to determine the number or sign at the beginning of the line. For example, if we want to use capital Roman numerals:

ul { List-style-type:upper-roman; }

The bullet can be removed by giving it a value of None.

list-style-image

In the bulleted lists we create with the ul tag, we can use this feature if we want to put an image that we specify instead of the beginning of the line:

ul { List-style-image:url(mark.jpg); }

 

commonly used css properties and values, css examples, important css properties, what is display, float examples, what is clear both for

EXERCISES

Css background fixed and background image cover Try It

Click on the Try It button and see, change, review the codes...

body {
    background: url('../Images/arkaplan.png') no-repeat fixed center top;
/* these 4 lines for picture to fill the screen */
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
    margin: 0;
    padding: 0;
}

 

Css border tutorials Try It

Click on the Try It button and see, change, review the codes...

Css list (ol and ul tags) styles Try It

ul {     

list-style-type:circle;

}

li {    

width:80%;

margin:5px;

padding:4px;

}

li:hover {     

color:yellow;

background-color:#003366;

list-style-type:disc;

}



COMMENTS




Read 581 times.

Online Users: 219



css-properties