1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to create div in css?

Discussion in 'CSS' started by anitarana, Mar 7, 2014.

  1. #1
    how to cerate div in css n how to connect div with html file?
     
    anitarana, Mar 7, 2014 IP
  2. loop

    loop Active Member

    Messages:
    519
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    90
    #2
    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";
    }
     
    loop, Mar 7, 2014 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    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
     
    kk5st, Mar 8, 2014 IP
  4. salmanshafiq

    salmanshafiq Well-Known Member

    Messages:
    260
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    128
    #4
    you cannot create the html elements through css.. you can just style the elements through css
     
    salmanshafiq, Mar 12, 2014 IP
  5. KingJabeyt

    KingJabeyt Member

    Messages:
    60
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #5
    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.
     
    KingJabeyt, Mar 18, 2014 IP
  6. salmanshafiq

    salmanshafiq Well-Known Member

    Messages:
    260
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    128
    #6
    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):
     
    salmanshafiq, Mar 19, 2014 IP
    Colleen likes this.
  7. DuneDreamer

    DuneDreamer Well-Known Member

    Messages:
    363
    Likes Received:
    213
    Best Answers:
    0
    Trophy Points:
    135
    #7
    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):
     
    DuneDreamer, Mar 19, 2014 IP
  8. himel2011

    himel2011 Greenhorn

    Messages:
    33
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #8
    div is html tag like any other html tag (<h1>,<p>,<li><table>,<marquee>,etc) and you need to style this tag via css..
     
    himel2011, Mar 20, 2014 IP
  9. chetan0045

    chetan0045 Greenhorn

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #9
    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 .:cool:
     
    chetan0045, Mar 24, 2014 IP
  10. toucansam

    toucansam Greenhorn

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #10
    think of every div element you create as its own object you style how the div looks by using css
     
    toucansam, Mar 30, 2014 IP