Skip to main content

Posts

Showing posts with the label tag

What is CSS Class ?

In CSS, classes allow you to apply a style to a given class of an element. To do this, you link the element to the style by declaring a style for the class, then assigning that class to the element. CSS Class Syntax You declare a CSS class by using a dot (.) followed by the class name. You make up the class name yourself. After the class name you simply enter the properties/values that you want to assign to your class. .class-name { property:value; } If you want to use the same class name for multiple elements, but each with a different style, you can prefix the dot with the HTML element name. html-element-name.class-name { property:value; } You can also select elements (or classes) that's nested within another element or class. For example, div.css-section p will select all elements that are nested within a <div> element that uses the .css-section class. One major benefit of doing this is that you don't need to apply a class to every instance of an ele...

Different element with different background in CSS

The example explains how we can color different element with different backgrounds. <head> <style> h1 { background-color: #6395ed; } p { background-color: #e000ff; } div { background-color: #b000de; } </style> </head> <body> I'am colored <div> This is a colored div. This is a colored para We are still in the div element. </div> </body> </html>

Three formats of calling css

Call using tag: We can call a css using the tag like below. td { padding: 5px; text-align: left; background-color: #F2F2F2; } Here all the attribute with td tag will be formatted with this css. Call using id: We can call a css using the id like below and the css will be applied to the particular attribute with this particular id. #p1 { background-color: #00FF00; padding: 2px; } Here all the attribute with td id 'p1' will be formatted with this css and while using id we should call id starting with a hash (#). And in html file <div> This call calls using id </div> Call using class: We can call a css using the attribute 'class' like below and the css will be applied to the particular attribute with this particular class attribute. .p1 { background-color: #00FF00; padding: 2px; } Here all the attribute with td id 'p1' will be formatted with this css and while using id we should ...

CSS - Borders

The border properties allow you to specify how the border of the box representing an element should look. There are three properties of a border you can change The border-color Specifies the color of a border. The border-style Specifies whether a border should be solid, dashed line, double line, or one of the other possible values. The border-width Specifies the width of a border. Now we will see how to use these properties with examples. The border-color Property: The border-color property allows you to change the color of the border surrounding an element. You can individually change the color of the bottom, left, top and right sides of an element's border using the properties: border-bottom-color changes the color of bottom border. border-top-color changes the color of top border. border-left-color changes the color of left border. border-right-color changes the color of right border. The border-style Property: The border-style property allows...

Centering Text with CSS

Centering text and other elements can easily be done with the CSS text-align property. Applying this to an internal or external stylesheet: p {text-align: center;} or this to inline styling: This is centered text

Html Interview Questions

Which browsers support HTML 5? Almost all browsers i.e. Safari, Chrome, Firefox, Opera, Internet Explorer support HTML 5. What is SVG? SVG stands for scalable vector graphics. It’s a text based graphic language which draws images using text, lines, dots etc. This makes it lightweight and renders faster. What is canvas in HTML 5? Canvas is an HTML area on which you can draw graphics. What are the restrictions of Web Worker thread? Web worker threads cannot modify HTML elements, global variables and some window properties like Window.Location. You are free to use javascript data types, XMLHttpRequest calls etc. How to terminate a web worker? w.terminate();

Alert, Confirm, and Prompt boxes in Javascript

The three "commands" involved in creating alert, confirm, and prompt boxes are: window.alert() window.confirm() window.prompt() window.alert() : This command pops up a message box displaying whatever you put in it. <body> <script type="text/javascript"> window.alert("Iam an alert box!!!") </script> </body> window.confirm(): Confirm is used to confirm a user about certain action, and decide between two choices depending on what the user chooses. <body> <script type="text/javascript"> var x=window.confirm("Are you sure?") if (x) window.alert("Yes!") else window.alert("No") </script> </body> window.prompt(): Prompt is used to allow a user to enter something, and do something with that info: <body> <script type="text/javascript"> var y=window.prompt("Enter your name here...") window.alert(y) </script> </body> ...

Formatting and Styling Text in CSS

Text indention [text-indent] The property text-indent allows you to add an elegant touch to text paragraphs by applying an indent to the first line of the paragraph. p { text-indent: 10px; } Text alignment [text-align] The CSS property text-align corresponds to the attribute align used in old versions of HTML. Text can either be aligned to the left, to the right or centred. In addition to this, the value justify will stretch each line so that both the right and left margins are straight. p { text-align: left; } h1{ text-align: right; } h2{ text-align: center; } b { text-align: justify; } Text decoration [text-decoration] The property text-decoration makes it is possible to add different "decorations" or "effects" to text. Some properties are underline, overline, line-through. h1 { text-decoration: underline; } h2 { text-decoration: overline; } h3 { text-decoration: l...

Transferring user to new web page automatically

<META HTTP-EQUIV="Refresh" CONTENT="2;URL=http://eazyprogramming.blogspot.in/"> Use the code above inside your head tag and your web page will be redirected to "http://eazyprogramming.blogspot.in/" within 2 seconds. Change the value of CONTENT="2" to some other integer to decrease or increase the delay of redirection of webpage.If "0" is given the change will be seen immediately.

Special Effects in HTML - Marquee

If you want your text to move with in the screen, use the tag   <marquee> .  The text in between the tags will move horizontally. <marquee bgcolor=pink> will give background color to marquee texts.   <marquee bgcolor=orange width=100 height=20> will set height and width for marquee text. <marquee bgcolor="orange" direction="right" height="20" width="100"> will set   direction to marquee text. <html> <body> This is a scrolling text This is a scrolling text with background color This is a scrolling text This is a scrolling text This is a scrolling text </body> </html> Copy and download the code and try your self.

Using Html Styles And Colors

Using html Styles and Colors : This post will help you to understand the use of div element and using styles and color elements perfectly. Copy the code and try... <html> <body> HTML STYLES AND COLORS Text with space Spannable Text </body> </html>

HTML Tags - Links

<a> This defines a hyperlink,which is used to link from one page to another.The most important attribute of the <a>element is the href attribute,which indicates the link's destination. <base> The <base> tag specifies the base URL/target for all relative URLs in a document. <html> <head> <body> Visit angel mark for more codes </body> </head> </html> <html> <head> <base href="http://eazyprogramming.blogspot.in/" > </head> <body> blog </body> </html>

HTML Basics

HTML (Hypertext Markup Language) is the set of   markup   symbols or codes inserted in a file intended for display on a World Wide Web   browser   page. The markup tells the Web browser how to display a Web page's words and images for the user. Each individual markup code is referred to as an element or called a tag . Some simple things to remember The text between <html> and </html> describes the web page The text between <body> and </body> is the visible page content HTML is a language for describing web pages. HTML stands for H yper T ext M arkup L anguage HTML is a markup language A markup language is a set of markup tags The tags describe document content HTML documents contain HTML tags and plain text HTML documents are also called web pages HTML markup tags are usually called HTML tags HTML tags are keywords (tag names) surrounded by angle brackets like <html> HTML tags normally come in pairs like <b...