Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS image positioning inside <div>

Tags:

html

css

I have been making a website and I want an opening image to be found on my screen. The problem is that I have the picture I want to use but it is to big for the space I want it to fit in. This could be solved 2 ways: I could scale the image to fit in the Div or I could position the image inside the div to show the essential parts of my picture. Ideally I would like the second option but I am ok with the first. I believe that I have done sufficient research on this question and this question is not like these:First, Second. I have also done my own experiments on this problem but using the position property and clear divs these have not worked to my satisfaction.

Here is what i believe to be the essential code for this question:

HTML:

<div class="jumbotron">
    <h1> New IQ Test </h1>
    <p>Take our quiz</p>
</div>

CSS:

.jumbotron {
    /*padding-left: 50px;
    padding-right: 10px;*/
    height: 500px;
    display:block;
    background-image: url(http://bit.ly/1IMUMR0);
    width: 100%;
    /*padding-top: 100px;
    position: absolute;
    bottom: -30px;*/
    text-align: center;
    color:white;
}

.jumbotron h1 {
    padding-top: 150px;
    font-weight: normal;
    opacity: 100;
    text-shadow: 0 0 10px black;
    font-family: Helvetica;
}

The image I am using is not owned by me. I realize this is illegal. I am NOT going to put this web page out for general use so it us ok if I use this image. All your help is greatly appreciated.


1 Answers

.jumbotron {
/*padding-left: 50px;
padding-right: 10px;*/
background-size: 100% 100%;
/*background-size: cover;*/
height: 500px;
display:block;
background-image: url(http://bit.ly/1IMUMR0);
width: 100%;
/*padding-top: 100px;
position: absolute;
bottom: -30px;*/
text-align: center;
color:white;
like image 186
jberk Avatar answered May 30 '26 08:05

jberk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!