Div tag in html css with example

CSS 3 cascading style sheets

what is div tag in css with example


CSS – Cascading Style Sheet In this lecture you will learn handling div tags in CSS you will know Definition and Usage The div tag defines a division or a section in an HTML document. The div tag is used as a container for HTML elements - which is then styled with CSS or manipulated with JavaScript. The div tag is easily styled by using the class or id attribute. Any sort of content can be put inside the div tag! Note: By default, browsers always place a line break before and after the div element. To use div tag to apply styles, add the style attribute to the relevant element. The style attribute can contain any CSS property. for instance div tag in css examples with source code here: <!DOCTYPE html> <html> <head> <style> .myDiv { border: 5px outset red; background-color: lightblue; text-align: center; } </style> </head> <body> <h1>The div element</h1> <div class="myDiv"> <h2>This is a heading in a div element</h2> <p>This is some text in a div element.</p> </div> <p>This is some text outside the div element which is style not applied.</p> </body> </html>

in the above shown example applied div tag to a html tag elements, in this example source code h2 tag is applied on style attribute with parameters are having with their values.
similarly second one p tag of html element is also applied for internal css style of color parameter with value

css tutorial

css

Web development course Data Science courses: Web Development
Online courseOnline Courses: Include Certification
Harisystems is optimized for learning, testing and training. courses are designed to be simplified to improve reading and basic understanding for beginners to expert level. Tutorials and examples are constantly reviewed to avoid errors, however we cannot warrant full correctness of all content. if any found need to correct write us at info@harisystems.com. we Harisystems is not responsible for any with this tutorials, While using this site, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 2007-2023 by Harisystems. All Rights Reserved.
Copyright © Harisystems 2023