Tags down


image in navigation bar css

By : Vojdan Karapetkovski
Date : May 03 2020, 08:59 AM

I have file navbar.php that is included in the index.php. The navbar looks and works fine but in one of the tabs I just have the word Logo and I wanted to replace it with an actual image. Just like many websites have it. I've seen many people using bootstrap however I'm not familiar with that at all. What is wrong with the PHP and CSS I'm trying to use?

Path of navbar.php project/file.css

Path of image.png project/img/image.png

navbar.php file :

<div class="navbar">
    <a class="logo" href="#" img src="img/image.png"></a>
    <div class="navbar-right">
        <a class="active" href="../index.php">Home</a>
        <a href="../include/about.php">About</a>

style.css file :

.navbar a.logo{
  width: 300px;
  height: 200px;
  background: url(img/image.png) 0 0 no-repeat;
Answer :

Your issue with the HTML markup is here

<a class="logo" href="#" img src="img/image.png"></a>

By the above markup, you are saying that a hyperlink should be an image or should act as an image or something like that. This doesn't make sense.

What you can do : you can visit this website: http://www.icons8.com and search your icons accordingly. You can also download it and store it in your system folder.

after you have done this,

you can write the above code as follows:

 <div class="navbar">
 <a class="logo" href="#"><span><img src="yourImgURLHere"/></span> </a>
 <div class="navbar-right">
 <a class="active" href="../index.php">Home</a>
 <a href="../include/about.php">About</a>

Hope this helps you : .

Share : facebook icon twitter icon
Related Posts Related Posts :
  • clear array after form submit
  • pass url variable to javascript
  • access data using api
  • div position fixed css
  • add horizontal line between two div
  • disable toggle button css
  • css fixed line height
  • background image not working
  • table cell border
  • text line break css
  • overlay div on div
  • text direction rtl css
  • javascript convert string to an object
  • bind inner div click to outer div
  • jquery ajax oncomplete
  • how to use promise in for loop
  • jquery get element using variable
  • javascript send textbox value
  • pass div class content to another class or id
  • css new line after element
  • css calc not working properly
  • link disabled jquery
  • sql join table to subquery
  • MS Access SQL Issue with OR AND Operators
  • set textarea value using php
  • php merge two arrays into one
  • php form with google captcha
  • update current row in php
  • php date format mysql
  • mysql pdo select query
  • php function return an array
  • PHP mysqldump database to sql file
  • display image query
  • php create array using foreach loop
  • associative array php
  • group_concat in mysql laravel
  • php array_push empty
  • mysql on update cascade not working
  • pdo insert prepared statement
  • mysql insert ignore vs on duplicate key
  • mysql insert into existing row
  • mysql multi insert query
  • mysql group by show all rows
  • php change profile image
  • combine multiple arrays into one array php
  • how to sum values in an array
  • how to get sum of the total time
  • How to Create Facebook live stream without notification using API ?
  • on button click make div visible
  • css affect another element on hover
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org