|
INTERVIEW QUESTIONS
WEB
CSS
DETAILS
Question: How do I place two paragraphs next to each other?
Answer: There are several ways to accomplish this effect, although each has its own benefits and drawbacks. We start with the simplest method of positioning two paragraphs next to each other.
<DIV style="float: left; width: 50%">Paragraph 1</DIV> <DIV style="float: left; width: 50%">Paragraph 2</DIV>
Trickier is this example, which relies on positioning but does not suffer the vertical-overlap problems which plague many other positioning solutions. The problem is that it relies on an incorrect positioning implementation, and will break down dramatically in conformant browsers.
<P> <SPAN STYLE="position: relative; left: 50%; width: 50%"> <SPAN STYLE="position: absolute; left: -100%; width: 100%"> Paragraph 1</SPAN> Paragraph 2</SPAN> </P>
If floating is not sufficient to your purposes, or you cannot accept display variances in older browsers, then it may be best to fall back to table-based solutions.
|
|
|
Category |
CSS Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8684 users |
Added on |
9/4/2014 |
Views |
68880 |
Rate it! |
|
|
Question:
How do I place two paragraphs next to each other?
Answer:
There are several ways to accomplish this effect, although each has its own benefits and drawbacks. We start with the simplest method of positioning two paragraphs next to each other.
<DIV style="float: left; width: 50%">Paragraph 1</DIV> <DIV style="float: left; width: 50%">Paragraph 2</DIV>
Trickier is this example, which relies on positioning but does not suffer the vertical-overlap problems which plague many other positioning solutions. The problem is that it relies on an incorrect positioning implementation, and will break down dramatically in conformant browsers.
<P> <SPAN STYLE="position: relative; left: 50%; width: 50%"> <SPAN STYLE="position: absolute; left: -100%; width: 100%"> Paragraph 1</SPAN> Paragraph 2</SPAN> </P>
If floating is not sufficient to your purposes, or you cannot accept display variances in older browsers, then it may be best to fall back to table-based solutions. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
I made a 10px-high div, but IE makes it 20px high...
|
View Answer
|
|
To what are partial URLs relative?
|
View Answer
|
|
Do URL's have quotes or not?
|
View Answer
|
|
Why can @import be at the top only?
|
View Answer
|
|
Justified Text?
|
View Answer
|
|
Do any WYSIWYG editors support the creation of Style Sheets? Any text-based HTML editors?
|
View Answer
|
|
Must I quote property values?
|
View Answer
|
|
How do I centre my page?
|
View Answer
|
|
What is the percentage value in 'font-size' relative to?
|
View Answer
|
|
Can I attach more than one declaration to a selector?
|
View Answer
|
|
How To Style Forms?
|
View Answer
|
|
How To Style Table Cells?
|
View Answer
|
|
How far can CSS be taken beyond the web page--that is, have generalized or non-web specific features for such things as page formatting or type setting?
|
View Answer
|
|
How frustrating is it to write a specification knowing that you're at the browser vendors' mercy?
|
View Answer
|
|
What is initial value?
|
View Answer
|
|
What is value?
|
View Answer
|
|
What is shorthand property?
|
View Answer
|
|
Why shouldn't I use fixed sized fonts ?
|
View Answer
|
|
What browsers support style sheets? To what extent?
|
View Answer
|
|
Which characters can CSS-names contain?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All CSS Interview Questions & Answers - Exam Mode /
Learning Mode
|