Adscend

Click Here



Click Here



Click Here

9.9.13

Display inline VS block

CSS Display:inline VS block

display:inline

This is default.
The element will be displayed inline, inside the current block on the same line.
An inline element has no line break before or after the element.

Example

<html>
<head>
<style type="text/css">
li
{
display:inline;
list-style-type:none;
}
</style>
</head>
<body>
<ul>
<li><a href="#">CCNA</a></li>
<li><a href="#">Subnet</a></li>
<li><a href="#">JavaScript</a></li>
<li><a href="#">PHP</a></li>
</ul>
</body>
</html>
Output
CCNA Subnet JavaScript PHP

display:block

The element will be displayed as a block like paragraphs and headers.
Block element uses the total width and create a break before or after the element.

Example

<html>
<head>
<style type="text/css">
li
{
display:block; 
list-style-type:none;
}
</style>
</head>
<body>
<ul>
<li><a href="#">CCNA</a></li>
<li><a href="#">Subnet</a></li>
<li><a href="#">JavaScript</a></li>
<li><a href="#">PHP</a></li>
</ul>
</body>
</html>
Output
CCNA
Subnet
JavaScript
PHP



No comments:

Post a Comment