Interview Questions on CSS
41. What are the values exist for text-align property?
1. left :-
code :- text-align:left;
use for : to align left side.
2. Right :-
code :- text-align:right;
use for : to align right side.
4. center :-
code :- text-align:center;
use for : to align center.
5. justify :-
code :- text-align:justify;
use for : to align both sides.
42. How to set two div blocks in one line?
Use float property; Ex:- <div style=”float:left;width:200px;height:100px;”> Div1 content </div> <div style=”float:left;width:200px; height:100px;”> Div2 content </div>
43. What is the use of font-weight property?
To set bold value. font-wight:bold;
44. What is the use of word-wrap property and what are all the values exist for that property?
Allow long words to be able to break and wrap onto the next line.
Ex :-
p.test {
word-wrap: break-word;
}
45. What is the difference using width:500px; and width:75%;
If we use width:500px. It will have same width even if we reduce the window size. If we use width:75%. It will be change the width to 75% of the windows size.
46. What is the use of min-width property?
To set minimum width we use min-width. when width is dynamically decreases it wont reduce more than min-width value.
47. What is the use of max-width value?
To set maximum width we use min-width. when width is dynamically increases it wont increase more than max-width value..
48. How to apply style for all <input> tags which has type text?
input[type=”text”]{
/* styles goes here */
}
49. Which style do we have to use to hide one <div> block?
Use :- display: none;
50. How to keep one div block always visible at top right side even when we scrolling?
Use position: fixed;top:0px;right:0px;