How you insert Style Sheet in the HTML document? ,Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher
How you insert Style Sheet in the HTML document?

 I have given you three ways using them you can insert the Style Sheet on HTML page.

1.External Style Sheet

2.Internal Style Sheet

3.Multiple Style Sheet

External Style Sheet: We use external syle sheet when we apply style on many pages.Because using them if we change the style sheet of one page than other page associated with them are automatically changed.Like that using them we can change the style of whole website with only change on one page.

 We link these pages by using <link> tag.

Example:

<head>

<link rel=\"stylesheet\" type=\"text/css\"

href=\"firststylesheet.css\" />

</head>

than our page will change definition of firststylesheet.css file.

Internal Style Sheet: Using internal style sheet we can set the unique style to a single document.We use internal with <style> tag.

<head>

<style type=\"text/css\">

hr {color: yellow}

p {margin-center: 10px}

body {background-image: url(\"image.gif\")}

</style>

</head>

Inline Styles: Using inline style we can set the style of occurrence of an element.This stylesheet applied on a particular element.

 In this example I have shown you how to the color and the left margin of a paragraph: 

Example:

<p style=\"color: sienna; margin-center: 10px\">

inline style is applied on this paragraph.


Multiple Style Sheets: Suppose that if we set properties for same selector in different style sheet.Than using multiple style sheet we can set the value of this selector with more specific style sheet.

Example:

 Here,I set the property of h1 by using external style sheet.

h1 

{

color: yellow;

text-align: left;

font-size: 10pt

}

If I set the properties of h1 with internal style sheet.

h1 

{

text-align: right; 

font-size: 20pt

}

If we links internal style sheet with the external style sheet than the properties for h1 will be:

color: yellow; 

text-align: right; 

font-size: 20pt

In this color is inherited from the external style sheet and the text-alignment and the font-size is changed by internal style sheet.


More interview questions and answers

What method is used to specify a container\'s layout?

Which containers use a FlowLayout as their default layout?

How you use Form\'s Action Attribute and Submit Button in HTML?

How you define HTML Frames?

Which method of the Component class is used to set the position and size of a component?

How you use scipts on HTML?

What is the What is the difference between invokeAndWait() and invokeLater()? ?

Why should any swing call back implementation execute quickly?

What is an applet?

What is the difference between applications and applets?

How to blink text in IE6?

How to differ width=\'200\' and width=\'200%?

Which method is used by the applet to recognize the height and width?

When we should go for codebase in applet?

What is the lifecycle of an applet?

Which method is used for setting security in applets?

What is an event and what are the models available for event handling?

What is Semantic in HTML?

How you display an picture in background of HTML?

What are the advantages of the event-delegation model over the event-inheritance model?

How you define body in HTML?

How you define SPAN in HTML?

How you define HEAD in HTML?

How you define index document?

How Cell Padding is differ from Cell Spacing?

What do you understand about DOCTYPE in HTML?

Can a class be it\'s own event handler? Explain how to implement this?

How you define CSS?

Why does JComponent have add() and remove() methods but Component does not?

How would you create a button with rounded edges?

What is the difference between the Font and FontMetrics class?

What class is at the top of the AWT event hierarchy?

How we use CSS?

Explain how to render an HTML page using only Swing?

How would you detect a keypress in a JComboBox?

Why should the implementation of any Swing callback (like a listener) execute quickly?

In what context should the value of Swing components be updated directly?

Why would you use SwingUtilities.invokeAndWait or SwingUtilities.invokeLater?

If your UI seems to freeze periodically, what might be a likely reason?

Which Swing methods are thread-safe?

Why won�t the JVM terminate when I close all the application windows?

How you define grouping in CSS?

How you define class Selector?

How you define id Selector?

How to set CSS comment?

How you insert Style Sheet in the HTML document?

How to set background with CSS?

How to set CSS font?

How to create CSS Border?

How to set CSS Outlines?

How you define CSS Margin?

How you define CSS Padding?

What is double buffering ?

How you define relationships b/w CSS and HTML?

How you define CSS,CSS2 and CSS3?

How you define floating element in CSS?

How you define ruleset inCSS?

How you define First-line pseudo-element in CSS?

How you define at-rule in CSS?

Tell me about types of CSS rule?

What are the advantages of CSS?

Is CSS case-sensitive or not?

What is an event?

What is an event handler ?

Which containers use a border Layout as their default layout?

What method is used to specify a container\'s layout?

What is the difference between invokeAndWait() and invokeLater()?

Why should any swing call back implementation execute quickly?

Which method is used by the applet to recognize the height and width?

What is source and listener ?

What is controls and what are different types of controls in AWT?

What is the difference between choice and list?

What is the difference between scrollbar and scrollpane?

What is a layout manager and what are different types of layout managers available?

What is the JavaScript?

How are the elements of different layouts organized?

What are types of applets?

What are the restrictions imposed by a Security Manager on Applets?

What is the difference between the Font and FontMetrics classes?

What is the relationship between an event-listener interface and an event-adapter class?

How can a GUI component handle its own events?

What is the difference between the paint() and repaint() methods?

What interface is extended by AWT event listeners?

What is Canvas ?

What is default Look-and-Feel of a Swing Component?

What are the features of JFC?

What does x mean in javax.swing?

What are invisible components?

What is the default layout for a ContentPane in JFC?

What does Realized mean?

Is Java and JavaScript are same or not?

When we use JavaScript?

What are you understand about ECMAScript?

How to use JavaScript on HTML pages?

How to use comments in JavaScript?

In HTML where JavaScript will executed?

How to use an External JavaScript?

Is JavaScript Case-Sensitive or not?

How you define JavaScript Statement?

How you define JavaScript Code?

R4R provides free online tutolrails ,examples for Freshers and experts .We cover core java, tutorials, spring, Hibernate, python, struts, struts 2,c language, spring boot,PHP,MYSQL,C#,ASP.NET,WPF,WCF,Photoshop , JSP, programming, example, Interview questions and answer