CSS

Interview Questions on CSS

31. How write style by using java script?

Syntax :- document.getElementById(‘idname’).style.propertynname=’value’;
Ex : - document.getElementById(‘container).style.color=red;

32. How to get style property value of one html element in javascript?

Syn :- document.getElementById(‘idname’).style.propertynname
Ex :-  var color = document.getElementById(‘container’).style.color;

33. How to get style property value of one html element in jQuery?

Syn :- $(‘element’).css( propertyName );
Ex 1 :-  
$('div').css(‘color’);
Ex 2 :-
$('#container’).css(‘color’);
Ex 3:-
$('.classname’).css(‘color’);

34. How to write the styles using jquery?

Syn :- $(‘element’).css( propertyName, value );
Ex 1 :-  
$('div').css(‘color’,’#FF3456’);
Ex 2 :-
$('#container’).css(‘color’,’# FF3456’’);
Ex 3:-
$('.classname’).css(‘color’,’ #FF3456’’);

35. How to collapse borders of cells into single line in tables?

Use :- border-collapse: collapse;
EX :- 
table {
    border-collapse: collapse;
}

36. How to set border corners into rounded shape?

Use :- border-radius: 5px; /*(you can change pixels)*/

37. How to set shadows for one div element?

Use :- box-shadow: 10px; /*(you can change pixels)*/

38. What is the use of margin property?

Set particular element in in mentioned distance.
margin      : distance in allsides.
margin-top  : Sets the top margin of an element
margin-bottom : Sets the bottom margin of an element
margin-left   : the left margin of an element
margin-right  : Sets the right margin of an element

Ex1 :- margin: 5px;
Ex2 :- margin-left: 5px;

39. What is the difference b/w margin and padding?

Padding is used to maintain the distance from border to content.
margin is used to set particular element in in mentioned distance.

40. How to set the text size?

Use font-size attribute.
Syn  font-size: /*give value here */;
Ex :- font-size: 40px; 

www.000webhost.com