Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > HTML / DHTML

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 09-06-2012, 04:16 AM   #1
davikerkrish
Registered User
 
Join Date: Jul 2012
Posts: 111
Block vs. inline level elements

Nearly all HTML elements are either block or inline elements. The characteristics of block elements include:

1)Always begin on a new line
2)Height, line-height and top and bottom margins can be manipulated
3)Width defaults to 100% of their containing element, unless a width is specified

Examples of block elements include <div>, <p>, <h1>, <form>, <ul> and <li>. Inline elements on the other hand have the opposite characteristics:

1)Begin on the same line
2)Height, line-height and top and bottom margins can't be changed
3)Width is as long as the text/image and can't be manipulated

Examples of inline elements include <span>, <a>, <label>, <input>, <img>, <strong> and <em>.

To change an element's status you can use display: inline or display: block. But what's the point of changing an element from being block to inline, or vice-versa? Well, at first it may seem like you might hardly ever use this, but in actual fact this is a very powerful technique, which you can use any time you want to:

1)Have an inline element start on a new line
2)Have a block element start on the same line
3)Control the width of an inline element (particularly useful for navigation links
4)Manipulate the height of an inline element
5)Set a background colour as wide as the text for block elements, without having to specify a width
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
davikerkrish is offline   Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inline image vertical alignment davikerkrish HTML / DHTML 0 09-06-2012 02:47 AM
important elements to rank top in Google Video and YouTube? jamesranatte Search Engine Optimization 1 08-07-2012 09:23 PM
The actual SEO three elements ruixuan Search Engine Optimization 1 03-15-2012 01:38 AM
How to prevent Line-Wrapping of text elements ncjbhd Programming General 1 11-25-2011 02:07 AM
High Level Linux VPS - High Performance - Affordable Prices - Instant Free Features AJKpeter Post your ad here 0 10-28-2011 07:25 AM


All times are GMT -7. The time now is 07:07 PM.


Powered by vBulletin Copyright © 2020 vBulletin Solutions, Inc.