Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizeable Image using twitter-bootstrap

I am trying twitter's framework to develop my own site and I want my image to resize as the browser size is decreased. I am confused and tried everything but couldn't come up with a solution here is my structure

HTML

<section id="intro">
      <div class="row" id="ruby">
        <div class="span6" id="heading">
          <h1>Journey Into Ruby and Beyond</h1>
          <p>A blog about my journey into ruby, my experiences and lots of fun!</p>
        </div>

        <div class="span6" id="pic" align="right">
           <p>Akash Soti<br>RoR Developer<br>@xyz company </p>
        </div>
    </section><!--/intro-->

CSS

#ruby.row{

margin-left: 0px;
padding-right: 0px;
padding-bottom: 0px;
}

#pic{

background: url(img/Akash.png);
background-repeat: no-repeat;
height: 150px;
width: 200px;
margin-left: 200px;

}

#pic img{

max-width:100% ;
    max-height:100% ;
    display:block;

}

#pic p{
position: relative;
right: 110px;
margin-top: 90px;
margin-left: 0px;
text-align: left;
}
like image 784
Akash Soti Avatar asked Dec 26 '22 19:12

Akash Soti


2 Answers

Twitter bootstrap is designed to make images (and layout) responsive, that is images in your content:

<img src="path/to/images.jpg" alt="some">

Not the images you used as background-images in CSS.

like image 89
Mark Avatar answered Dec 29 '22 08:12

Mark


You have to use

@media (max-width: 699px) {
#pic{
background: url(img/Akash.png);
background-repeat: no-repeat;
height: 100px;
width: 150px;
margin-left: 200px;
}
}

But if you want responsive design, try to avoid pixels, use %. And if your background meant to be picture(e.g. photo, pic) but not background-kind of image, use <img> instead

like image 45
Avdept Avatar answered Dec 29 '22 09:12

Avdept