creating HTML Div, span, class, and ID
Div, span, class, and ID
.<div,> <span,>, class, and id
<div> element: act as a group to collect togather multiple element that we have or want to take togather in html ltdivgt also act as a block
<span> elementThese element unlike div element it act as inline,it can go in line as part of a text without any effect.eg we shall put a span some were around our text like this
<p>Web pages are being created using <span style="color:lime"> html,css, and javascript</span> which is very easy for any one to learn and do it him self</p>
Web pages are being created using html,css, and javascript which is very easy for any one to learn and do it him self
Now replace the <span> with <div> to see what will happen and that is the difference between <div> and <span>
class and iD
Classes and IDs are two very important attributes that can go on any html element
class:is used to group togather element that are alike in some ways.
IDs:is used to identify one particular element that we want to interract with.eg
now we use can specify the list items that have the class "container". The selector for classes use the symbol'.' so in this example our selector would be .container , then we will use it to add css to our class like this:
.container{background-color:#00B200;
border:solid 3px #008A00;
border-radius:10px;
}
To make this work also we most put it between the tags <style>.....</style> in the head section of our page eg
<html><head>
<title> my first web page </title>
<style>
.container{background-color:#00B200;
border:solid 3px #008A00;
border-radius:10px;
}
</style> </head>
<body>
<h2> this is my first html web page </h2>
<div class="container">Our website focuse on html, css, javascript and php</div> </body>
</html>
here is our result:
Comments