You can't create any web element with CSS, only with javascript. You can insert content in element but it can be only text. .someclass:after{ content:"some text"; }
I have the feeling you are missing the right terminology or simply trying to do the wrong thing. Instead of asking how to do what you determined was the solution, tell us what result you're seeking. cheers, gary
maybe you meant: "how to create css in div and how to connect css with html file?"? coz as what were mentioned above, you can't create div with css.
Creation of Div in HTML with class name "my-class" <div class="my-class"> Your text will be here... </div> Code (markup): Define the class in css file... .my-class{ color : red; font-size : 20px; /* you can put custom styling here.. */ } Code (markup): It will be automtically connected with the div which has class "my-class" but you should add the css in the head section of the HTML <link rel="stylesheet" media="all" href="path-of-css/file-name.css"> Code (markup):
I hope this example answers your question. Using an internal style sheet, and applying styles to a div tag inside an html tag: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <style> .news { width: 208px; padding: 16px; font-size: 90%; line-height: 1.8; background: rgb(237,226,197); margin-right: 32px; float:left; } </style> <body> <div class="news"><h3>A quick note</h3><p>The preceding news section had absolutely nothing to do with news. Nothing. It was more a very lame attempt at making a joke out of several very serious branches of metaphysical study. We apologize for the deliberate waste of time, and promise that from this point on, nothing will be discussed in these sections other than cold, hard, metaphysical facts. Thank you.</p> </div> </body> </html> Code (markup):
div is html tag like any other html tag (<h1>,<p>,<li><table>,<marquee>,etc) and you need to style this tag via css..
DIV tag used in html file only. you must know that .html and .css are different files. You can say .html is a body and .css is the clothes. you can design the clothes and make body(of site) attractive .