Tuesday, July 15, 2014

Divs and Spans

Whats divs and spans and whats the difference between them
the div and span are kinda the same but how can we know how to use div or span first of all lets know what are the divs and spans 
  • Divs: they used to make sections of our webpage that means if you want to make a space of your webpage to use it to show some pics its good to use div so when we use div tag it make a new section of the webpage body so for example :
          <html>
          <head>
          </head>
          <body>
          <div> 
                  <p>hello</p>
          </div>
           <p> this text will not be near to the "hello" or at least in a different location</p>
           <body>
           </html>
           divs are commonly used to make multi sections of website each section has its tags and objects 
           and <div> just like every tag in html it has Id,class,name......etc
  •     spans i said that spans are kinda the same yeah because they make a new section too but whats the difference between them the difference is that spans DONT make space after the tag closed so if we write it in paragraph it'll be in the same paragraph for example :
         <html>
         <head>
         <style type="text/css">
          red.
         {
             color:red; 
         }
         </style>
         </head>
         <body> 
         <p> hello <span class="red"> welcome to my webpage</span> thanks for visiting</p> */ this will                make the paragraph in the same line nothing will change only the color of whats inside the span
         </body>
        </html>
  • But divs wont make it in the same line because it'll make a new line so if we do it like this :
         <html>
          <head>
          </head>
          <body>  
          <p> hello <div> Welcome to my blog</div> thanks for visiting </p> */ the webpage will be like this:
                                hello    Welcome to my blog
                                            thanks for visiting
           </body> 
           </html>
its not that big difference but as i see that the most web developers use the div more so its all up to you since you know what does each of them means 

thank you guys for being here hope you like my tutorials 

if you have any questions please leave a comment or email me 

"Recommended Me :D"


No comments:

Post a Comment