Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS no background image

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #38818
    ijfrjfr
    Member

    Hi,

    I have defined the

    tag in my css to use a background something like:

    h2{
    font-family: "Times New Roman", Times, serif;
    color: #FFF;
    font-size: 2.6em;
    background-image: url(../images/some_pic.png);
    background-repeat: no-repeat;
    width: 318px;
    font-weight: normal;
    }

    So all my

    title

    will get that background image.

    I need however that under certain div’s the h2’s to not use any background image, so in situations like

    title

    (this code is generated from an external source and I cannot control it)

    How can I achive that?

    I tried to define

    .twtr-bd h2{
    ...................
    }

    but it didn’t work.

    Thanks in advance for your help!

    Thanks!

    #105639
    chrisburton
    Participant

    Try h2.twtr-bd instead. Can’t really tell what you did until a mod cleans up your post.

    #105654
    Jeager
    Member

    You should be able to define it by saying

    #divname h2 { background:none; }

    For whatever reason that actually does not work. I would of expected the specific path to cause only that div to show no background, but it makes no divs work. So here is a codepen. Same thought process but a little more specific

    http://codepen.io/pen/9818/1

    #105712
    piotrex41
    Member

    If you want backgorund-image in h2, you must add display:block and width, height this images.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.