Creating a unique logo effect with transparent borders that seamlessly blend into the background color of the div

https://i.sstatic.net/057Pk.png

I have been experimenting with different approaches to design the white navigation menu that is supposed to span across the top of the image. However, I am struggling to make it scale gracefully in CSS. I am considering using the standard Bootstrap navbar with a white background and making only the section with the logo transparent. As a backend developer trying to figure this out, I might be overcomplicating things. Any suggestions or examples would be highly appreciated!

//edit: I forgot to include a link to the development site. Here it is.

So far, my main attempt has been creating an extremely wide image of the logo and the navbar. While this approach works, it becomes challenging to maintain consistency when ensuring responsive behavior.

Below is a snippet of the CSS code for the header I am currently using.

.ge-menu{
    font-family:'Montserrat', sans-serif;
    position:absolute;
    top:40px;
    background-image:url('/wp-content/uploads/2019/03/Header-mobile.png');
    background-size:cover;
    background-position:top;
    background-repeat:no-repeat;
    width:100%;
    height:280px;
    margin-top:-10px;
    z-index:100;
}

Answer №1

It's not flawless, but it's a good place to start. Simply apply transform: skew(-45deg); to certain elements and add space between them. It might be easiest to do this with separate elements.

body {
  background: #CCC;
  margin: 0;
}

header {
  display: flex;
  border-top: 20px solid #57bc90;
}

.split-bar {
  background: #FFF;
  width: 200px;
  height: 50px;
  margin-top: 10px;
  transform: skew(-45deg);
}

#split-bar-left {
  margin-left: -35px;
}
#logo-bar {
  height: 150px;
  width: 200px;
  background: #014039;
  transform: skew(-45deg);
  margin-left: -20px;
  margin-right: 60px;
}

#logo {
  position: absolute;
  left: 210px;
  top: 50px;
  color: #FFF;
}
<header>
  <div class="split-bar" id="split-bar-left"></div>
  <div id="logo-bar"></div>
  <h1 id="logo">Logo</h1>
  <div class="split-bar" id="split-bar-right"></div>
</header>

EDIT: Upon further consideration, you could just use the #logo-bar element and leverage the ::before and ::after pseudo-elements to generate the white bar backgrounds.

Answer №2

Try using the CSS property transform to rotate your container element.

.container-logo {
background: grey;
transform: rotate(-45deg);
width: 200px;
height: 100px;
}
.logo {
position: absolute;
transform: rotate(45deg);
right: 100px;
top: 50px;
color: white;
}
<div class="container-logo">
  <div class="logo">
    logo
  </div>
</div>

Answer №3

When creating the navbar, it's best to begin with 4 key elements.

  1. Left white bar
  2. Right white bar
  3. Green rectangle
  4. Logo

Start by positioning the white bars. Add an :after in css on the first bar (to create a triangle behind it). Include a :before in css on the other bar (to create a triangle in front of it).

Next, place the green rectangle between the two bars and apply rotation as needed.

To finish off, position logo.png on top of the green rectangle. Make sure the image has a transparent background.


Regarding responsive design, it ultimately depends on your specific requirements. Feel free to reach out for further assistance or guidance.

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

Changing the color of a progress bar in Bootstrap based on a specific percentage level

var elem = document.getElementById("progress-bar"); var progress = 75; elem.style.width = 80 + '%'; if (progress > 80) { elem.style.background = "red"; } #myProgress { height: 5px; } #progress-bar { w ...

Is there a way to stop these symbols (♈♉♊♋♌♍♎♏♐♑♒♓) from being substituted with emojis?

I am currently working on a project involving the simulation of the Prague Astronomical Clock (). My goal is to display the glyphs representing signs of the zodiac, which are in the Unicode range U+263C-2653 along with other astronomical symbols. My prefe ...

Stop the automatic hiding of the sticky header when reaching the bottom of the page

I have implemented the position: sticky property for my website's header. However, I am facing an issue where the header becomes hidden when I scroll halfway down the page (bottom on mobile devices). Can anyone suggest a solution to fix this problem? ...

utilize the form select element rather than the iframe

My sidebar is 200px wide and 300px tall, but my list of links has grown to fill the entire height of the sidebar. I am unsure of the best approach moving forward: Option 1) Embed the list in an iframe and allow the user to scroll through it. Option 2) Ut ...

What is the best way to show a title when hovering over an AngularJS expression that is displayed on an HTML page?

I am working on a section of my HTML page that looks like this: <div ng-app="" ng-init="patient={firstName:'John',lastName:'Doe'}"> <p>{{ patient.firstName}} | {{ patient.lastName }}</p> </div> This section ...

Achieving Flexbox compatibility with child elements in a horizontal MUI Collapse Component and TransitionGroup transitions: A comprehensive guide

Struggling with incorporating the Collapse + TransitionGroup Component in MUI while trying to make the containers expand using flexbox. <Box sx={{display: 'flex', height: '100vh', width: '100vw'}}> <Box sx={{flex: 1 ...

The feature of Google street view is not supported within the tabs on WordPress

I'm experiencing some issues with displaying Google maps and street view using the Wp Google Map WordPress plugin within tabs. The map displays perfectly on the first tab where I placed the short code for the map, but on the second tab where I placed ...

Is there a way to obtain a user's screen size without relying on a physical device or measuring the diagonal?

I'm looking for a way to display something at its actual size on a browser. For instance, if something appears to be 20cm on the screen, I want it to truly measure up to 20cm. Some methods involve considering the diagonal resolution of the screen, li ...

What might be causing the status problem to not display correctly?

My toggle feature to switch between no issue and issue is not displaying the status correctly. Despite trying to troubleshoot, I can't figure out why the issue section is not showing up. <!DOCTYPE html> <html> <script src="https://aj ...

Modify the shading of the mesh generated with the face3 method

I have utilized face 3 and three js to generate a mesh, but the expected color is not displaying correctly on the mesh. Below is the code snippet I used: var geometry = new THREE.Geometry(); var f = 0; for (var i = 0; i < data.real.length ...

Angular <select><option> tags are missing from the browser display, although they are present in the source HTML code

After incorporating a dropdown list into the FormGroup, it seems to be missing from the browser display. Upon inspecting the page's HTML source on Chrome, I noticed that the <select><option></option></select> element is present ...

Is there a way to switch colors with the click of a button?

I'm looking to incorporate a bootstrap color picker into my website. I want the button inside this div to trigger the color chart and change the background color of the entire div when clicked. Can anyone help me achieve this functionality? <d ...

The redirection of the URL after form submission is not functioning correctly

I'm attempting to develop a pair of dropdown lists in Elementor where the second dropdown's options depend on what is selected in the first, and the second contains URLs linked to a GO button that redirects to the chosen URL. However, I've f ...

Creating a lively JQ plot and saving it within an HTML file from a .aspx page using C# .net

I am currently in the process of developing a web-based application using Bootstrap. My goal is to save a .aspx page as an HTML file within my application. Upon writing the code: using System; using System.Collections.Generic; using System.Linq; using S ...

External CSS file unable to load background image as referenced

I am facing an issue with this code in my external CSS file as it doesn't seem to work at all. Strangely, when I move it internally, everything functions perfectly. Any thoughts on what could be causing this discrepancy? html { background-image:url(i ...

Sliding Dropdown Menu with Dynamic Title Change Upon Selection

I'm having an issue with a dropdown menu on hover that slides down and then back up. The active list item serves as the title of the dropdown. When a user clicks on an <li>, it becomes active and receives the class active-markup-style which sets ...

SVG: spin the entire text

I need assistance rotating a list of words at an angle, specifically tilting only the characters: https://i.sstatic.net/r96Mt.png Here is my code: <svg width="2000" height="130"> <g *ngFor="let fruit of fruits"> <g> ...

Utilize CSS to position an image in four various locations on a web page

Expressing this may be a challenge, but I'll give it a shot. Within a div, there is text that can vary in length based on user input. My goal is to have the ability to insert an image in one of several positions, determined by the selection made in a ...

Creating a standalone Wordpress child theme with its own CSS

After creating a child theme based on the responsive i-transform theme from http://templatesnext.org/itrans/, I found myself continuously undoing the i-transform CSS, which is taking up a lot of my time. However, if I remove the entire parent stylesheet, t ...

What steps can be taken to enable users to send and receive messages on my chat website?

I just completed creating a chat website using HTML, CSS, JavaScript, and jQuery and have now published it. You can view it at However, the site still lacks the functionality that would allow users to send and receive messages through it. Can anyone prov ...