Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background Image for header

I want to add background image to the header and set the background position for it. Here`s my code which is not working..

HTML

 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Home</title>
<!-- Meta viewport tag is to adjust to all Mobile screen Resolutions-->
<meta name="viewport"
    content="width=device-width, initial-scale=1, maximum-scale=1" />

<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" type="text/css" href="css/Jstyle.css" />
<script type="text/javascript" src="Javascript/jquery1.js"></script>
<script type="text/javascript" src="Javascript/jquery2.js"></script>

</head>
<body>
    <div data-role="page" id="project">


        <div data-role="header" class="header"></div>

        <div id="ad" align="center">

            <img alt="image" src="images/ad.png">

        </div>


        <div data-role="content">
            <div id="product" align="center">
                <img alt="image2" src="images/product.png">

            </div>




            <!-- Style card  -->

            <div id="style" align="center">
                <img alt="image2" src="images/style_card.png">

            </div>
            <!-- Social  -->

            <div id="social" align="center">
                <img alt="image2" src="images/app_store.png"> <img
                    alt="image2" src="images/social.png">
            </div>
        </div>
    </div>

</body>

CSS:

.header{

background-image:url("images/image_bg_inner.png");

width:200px;

background-color: #B00C0C;

}

Tried with .ui-header also.. and it`s not working. Please help me how can I do the same..

like image 845
Ashwin Avatar asked Feb 21 '26 07:02

Ashwin


2 Answers

Try :

.header {
width:200px;
background-image:url("images/image_bg_inner.png");
}

Maybe the background-color is conflicting with background-image.

Or:

Add height to your header.

.header {
width:200px;
background-color: #B00C0C;
background-image:url("images/image_bg_inner.png");
min-height:70px;
}
like image 122
Muhammad Talha Akbar Avatar answered Feb 26 '26 10:02

Muhammad Talha Akbar


This works fine for me.

<style type="text/css">
.ui-header {
  height:200px; /* any height */
  background-image:url(newlogo.png);
  background-repeat:no-repeat;
  background-position:center;
}
</style>
like image 36
Omar Avatar answered Feb 26 '26 11:02

Omar



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!