Tips for protruding the "logo" beyond the navigation bar

I have been grappling with how to extend a logo from the Navbar using SVGs.

Check out my codepen demo here: https://codepen.io/Stefan_K/pen/qYweej

HTML/ Navbar:

<nav class="navbar navbar-expand-lg">
  <a class="navbar-brand">
    <svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
  </a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Dropdown
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

CSS:

nav {
  background-color: firebrick;
}

svg {
  position: relative;
  top: 70px
}

The provided example showcases my progress so far. My goal is to project the logo (yellow circle) beyond the bounds of the navigation - partially inside, partially outside while preserving the default height of the navbar.

Answer №1

If you want to achieve this effect, simply use the following code:

.logo {
    position: fixed;
    top: 10px;
}
.menu-items {
    margin-left: 80px;
}

Make sure to strip all styles from the svg elements.

https://codepen.io/John_doe/pen/bazKxy

Answer №2

Check out the latest version on CodePen

New CSS Styles

header {
  background-color: navy;
}

img {
  position: relative;
  top: 10px;
}
.navbar.navbar-expand-lg .navbar-collapse{
 margin-left : 100px;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Send Angular to different Controller post successful Login

I'm having trouble figuring out how to route my angular app to a new controller after the user logs in. My app is pretty simple, it uses 'loginservice'... once the user logs in, it should go to /home which has a different template than the i ...

Newbie in PHP: Techniques for transferring PHP variables between different sections of PHP code

In my project, I have a file named index.php which is responsible for uploading files to the server and setting PHP variables such as $target_folder_and_file_name. This index.php file also includes the following line (originally it was in an index.html fi ...

How can I overlay text onto an image using ReactJS?

Today, I made the decision to venture into ReactJS and begin creating my own blog. One of the challenges I faced was trying to add text on an image in the header - only to find that the text kept sliding down. In order to ensure proper alignment, I needed ...

jquery hovering illustration extension

I recently came across a website called Consumer Barometer (http://www.consumerbarometer.com) and was impressed by its design. I tried to find a similar jQuery plugin, but had no luck. Eventually, I stumbled upon this website (http://blog.hostgrenade.com/2 ...

Styling images using CSS and AngularJS's NG-Repeat functionality

I am currently working on formatting images in AngularJS to display them next to each other in rows of four. However, it seems like when the code is generated from Angular, it is not displaying as expected. Below is a snippet of my HTML: <span ng-repea ...

Storing information in a database

Need help troubleshooting why my form isn't saving data to the database. <div class="container"> <div class="row" style="margin-top:200px;"> <form ENCTYPE="multipart/form-data" ACTION="upload.php" METHO ...

How can I add text to a bar or table using CSS/HTML?

I am trying to create a design similar to this: http://img291.imageshack.us/img291/5571/bartablestyling.png Currently, I only have the top bar in place. When I attempt to add text, it ends up below the profile picture. I want to avoid using float:left ...

The continuous cycle of animated effects using animate.css

I've been using animate.css to add animations to my elements, and here's a snippet of the code I'm working with: <button class='animated infinite pulse tada'>1</button> <button class='animated infinite pulse ta ...

"Interactive" - Utilizing javascript and html5 to create engaging game animations

Imagine I have a base class that looks like this: function Tile(obj) { //lots of default variables such as colors and opacity here } Tile.prototype.Draw = function () { ctx.fillStyle = "rgba(" + this.Red + "," + this.Green + "," + this.Blue + "," ...

Concerns with "redirecting links script"

Check out this code snippet: <script> if(document.location.href.indexOf('https://customdomain.com/collections/all?sort_by=best-selling') > -1) { document.location.href = 'https://customdomain.com/pages/bestsellers'; } </sc ...

What issue can be identified in this HTML/CSS code?

Here is the code snippet I am working with: http://jsfiddle.net/7jGHS/1299/ This is the HTML code: <div class="text1"><h2><span>THIS IS A TEST</span></h2> <p>1800 - 1570 - 000</p> <h2><span>T ...

Struggling with finding the appropriate CSS selector?

I'm struggling to find the correct selector. Let me do my best to explain the situation: I am currently working on a project where I am unable to make changes to the HTML and JavaScript due to dynamic content and other constraints. Within this proj ...

Having trouble reloading a seekbar (input range) in Angular 7 with a function?

I am currently in the process of developing a music player using Angular 7, and below is the HTML code for my component: <div class="track-controller"> <small>{{musicPlayerService.getCurrentTime()}}</small> <div class="progress- ...

"Can someone provide step-by-step instructions on how to mount a Vue 3 CLI project similar to

I have successfully created a pen that works here. Now, I am attempting to recreate the same application within a vue-cli project. Everything is set to default settings (vue3 preview), except for these 2 specific files: main.js import { createApp } from ...

Retrieve the content of a specific HTML tag using JavaScript

Is it possible to extract the content of a specific HTML tag as a string or XML format? <body> <script src="jquery.min.js"> //var test = document.getElementsByTagName("input"); //alert(test[0]); $(document).ready(function ( ...

Enhance mix-blend mode or filtering effects in SCSS using an SVG component in VueJS

I am currently developing a fixed navbar at the top of a webpage with several SVGs inside anchor tags. I want the SVGs to appear black when displayed over lighter colored divs (other Vue components) and white when displayed over darker colored ones. The ba ...

Is it possible to conceal my Sticky Div in MUI5 once I've scrolled to the bottom of the parent div?

Sample link to see the demonstration: https://stackblitz.com/edit/react-5xt9r5?file=demo.tsx I am looking for a way to conceal a fixed div once I reach the bottom of its parent container while scrolling down. Below is a snippet illustrating how I struct ...

Finding web page links from competition rankings using pattern matching

Challenge I am currently delving into the realm of natural language processing projects. Before diving in, I intend to explore existing works on datasets, particularly those organized on a leaderboard (refer to the "Three-way Classification" section). Ho ...

Exploring Vue and Webpack's tree shaking functionality, side effects management, and its impact on CSS: Loading unused component CSS

We are currently grappling with the challenge of effectively implementing tree shaking for CSS within Vue Single File Components using Webpack. Within our package.json file, we have specified: "sideEffects": ["*.css", "*.less","*.vue"], which appears to b ...

"Enhance your webpage with Flexslider and captivating stretched images

When working with Flexslider, I encountered a challenge where the image was being stretched to fit the width of the flexslider. I prefer the image to be displayed centered, keeping its original dimensions, and having a black background-color. Is there a ...