Corrie Byrd
Corrie Byrd

Reputation: 31

Using div class to set css style - not working

Here is the CSS and below it is the html code. Not sure why this setup is not working. Any help would be appreciated.

div.logo img {
    height: 100px; 
    width: 200;  
    position: absolute; 
    display: table-cell; 

}

<div class="a container-fluid">
        <div class="row">
        <div class="col-md-12">
          <div class="logo"><img  src="logo.png">

Upvotes: 1

Views: 204

Answers (3)

Heena26
Heena26

Reputation: 7

Try giving position: relative to the parent container, and give display:block to the div 'logo', maybe it'll work for you then. Although same piece of code is working for me in CodePen, or attach fiddle along with this for better clarity.

Upvotes: 1

zzeroo
zzeroo

Reputation: 5636

Try this:

div.logo img {
    height: 100px; 
    width: 200;  
    position: absolute; 
    display: block;
    border:1px solid red;
}

<div class="a container-fluid">
  <div class="row">
    <div class="col-md-12">
      <div class="logo">
        <img  src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" />
      </div>
    </div>
  </div>
</div>

https://jsfiddle.net/42eot71s/

Upvotes: 0

dawn
dawn

Reputation: 995

you should set the img "display:block"

Upvotes: 1

Related Questions