web training room for online courses
Online Training for Asp.net MVC Web Designing Development, MS SQL, Digital Marketing

How to use <span> tag in HTML page

Span tag is almost like a Div tag in Html, but there is some differences
Span tag occupy the space of the of content size, means if my content width is 100 pixel and I put that content inside a span tag, by default the span width will be 100 pixel same as content width, on the other hand Div tag will occupy the entire width of screen by default

When to use Span tag

Span is very useful when you want to highlight some small content within a big paragraph or any repeated content to be highlighted horizontally

Let’s look at some <span> example

Here we will write few country name, each country name will be written inside a span tag like this way

India USA Canada

Here is the code we have written
<style>
.countryName
{
padding: 10px;
margin: 10px;
background-color: #f00;
color: #fff;
}
</style>
<span class="countryName">India</span>
<span class="countryName">USA</span>
<span class="countryName">Canada</span>

Comment
Name Email Website
Subscribe
 
Span tag in HTML, Online HTML Tutorial


Consulting