Remove the presence of a black square when selecting elements using CSS

Update:

After some investigation, I discovered that the mysterious black square is actually a part of the scroll bar. By adding the following code snippet:

select::-webkit-scrollbar {
    display: none;
}

The square no longer appears.

Initially, my select element appeared normal when not focused: See here

However, upon focusing on it, an odd black square would appear in the top left corner: See here

Does anyone have suggestions on how to resolve this issue?

Here's the relevant portion of my code for reference:

<style>
html {
  background-color: dodgerblue;
  text-align: center;
}

select {
  background-color: transparent;
  border: 1px solid #ffffff;
  color: white;
  font-family: inherit;
  outline: none;
  padding-bottom: 100px;
  padding-top: 100px;
  width: 150px;
}

select option {
  padding: 10px;
}
</style>

<select size="2">
  <option>Option 1</option>
  <option>Option 2</option>
</select>

Thank you in advance for any assistance.

Answer №1

Apply the following style to your container

outline: none !important;

Answer №2

Your code for the select element is well-organized and tidy.

The issue may lie elsewhere in your HTML file, possibly stemming from additional CSS or JavaScript code.

To enhance cleanliness, consider enclosing your select element within a clearfix class. However, thorough examination of your HTML structure is necessary to pinpoint the exact problem.

html {
  background-color: dodgerblue;
  text-align: center;
}

select {
  background-color: transparent;
  border: 1px solid #ffffff;
  color: white;
  font-family: inherit;
  outline: none;
  padding-bottom: 100px;
  padding-top: 100px;
  width: 150px;
}

select option {
  padding: 10px;
}

.clearfix:before {
  content: " ";
    display: table;
}
.clearfix:after {
  clear: both;
}
<div class="clearfix">
<select size="2">
  <option>Option 1</option>
  <option>Option 2</option>
</select>
</div>

Answer №3

Include the following in the component

  -moz-transition: none !important;
              -ms-transition: none !important;
             -webkit-transform: none !important;

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

Encountering issues with integrating Sass into Angular 4

Hi there! I recently started a new project in Angular 4 and encountered some issues with the Sass styling. Every time I try to add sass and run the project, I keep getting this error message: body{ h1{ color : red; } } ^ Invalid ...

Place the child DIV at the bottom of its parent DIV

I've searched through open questions but couldn't find a solution. The code snippet in question looks like this: ... <div style="some height"> <div style="some width"> .......and so on.. .. < ...

Angular 6 seems to be having issues loading Bootstrap

I've run into an issue while trying to incorporate Bootstrap into Angular 6. I have already installed Bootstrap using npm install bootstrap and added it to angular.json, but it's still not functioning. Is there something else I should be doing? A ...

Utilize Bootstrap to switch between 'collapse' and 'collapse in' depending on the device being used

I have a collapsible panel set to default "expand" (collapse in) and it is working well. However, I would like to make it "collapse" (shrink) for mobile and tablet devices. Is there any built-in feature in Bootstrap that can help me achieve this? <div ...

The vertical alignment of the button text with SVG is not properly aligned

I'm facing a challenge in vertically centering text in a button while also using SVG. The text is centered properly when the SVG is removed. How can I maintain the SVG size and still achieve vertical text centering? https://i.sstatic.net/PJRtR.png ...

Using jQuery to set the background-image on the body's after pseudo-element with CSS

I am currently utilizing body:after for setting the page wallpaper. body:after { background-image: url('assets/img/wallpapers/<?php echo $getWallpaperFile; ?>'); } CSS content: ' '; display: block; position: absolute; left: ...

Display data-content vertically using CSS

Looking for a way to display text vertically one by one with CSS? While the rotation method produces this result: https://i.stack.imgur.com/utAiN.png However, I aim to achieve something more like this: https://i.stack.imgur.com/fuVyb.png If you have an ...

Ways to send data to a popup in svelte

Hey there, I could really use some assistance with my Svelte app. I'm trying to implement a modal and pass a parameter to the modal component in order to customize its content. However, when using the open() function of Modal, we only need to provide ...

Shifting text higher to the <h1> tag using CSS

I'm currently attempting to move the paragraph header closer to my h1 title. I'm struggling with incorporating the position function and have tried using padding without success. On the image, I am aiming to position the text "Where every connec ...

HTML animation effect on subpage with a URL modification [LATEST UPDATE]

Can you smoothly load a new subpage in the background, update the URL, and fade it in while an animation is playing on the previous page? Check out this example (jsFiddle) to see a simple animation: $(document).ready(function() { 'use strict&apo ...

Creating a flexible Tic Tac Toe board using only HTML and CSS without any JavaScript

I'm currently tackling an HTML layout challenge that involves creating a responsive Tic Tac Toe board using only HTML and CSS, without any JavaScript. This is how I have structured the layout of the board: <div class="board"> <div class= ...

Enhancing your design with animated borders on hover

This unique border animation caught my eye and sparked my curiosity. I'm interested to know if it can be achieved using only HTML5/CSS for a hover effect. Have you discovered any other visually appealing hover animations worth mentioning? ...

Adjusting element placement on collapsed navbar using Bootstrap

I've been developing a navbar for a webpage and have successfully aligned the data left and right with the Brand in the center. However, when the navbar collapses, the alignment shifts to Left (over) Brand (over) Right. I want the Brand to remain at t ...

the mobile website is not properly aligned on a horizontal axis

As I work on creating a mobile version of my website, I've come across a challenge: The entire site fits perfectly on the computer at a browser width of 480px, but when viewed on my mobile phone (regardless of the browser used), it leaves space on the ...

Can you employ a right-side offset in Bootstrap 4?

Is it possible to align a button with a textbox using the Bootstrap 4 layout system? https://i.sstatic.net/tN9II.png <link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/> <div ...

Adjust the properties within the component's styles using Angular 2

In this project, the objective is to dynamically change the background-color based on different routes. The goal is to display a specific color for UpcomingComponent while keeping the background-color consistent for all other routes. The approach involves ...

Leveraging JavaScript to access the margin-top property of the HTML and body tags

I'm having trouble retrieving the "marginTop" style property from the <html> and <body> tags. While Chrome developer tools shows that margin-top is being set via in-HTML CSS: <style type="text/css" media="screen"> html { margin-top: ...

Utilize Flexbox to arrange elements in a grid layout based on specified number of columns and rows

My div is currently empty. <div id="container"></div> I have applied the following styling with CSS: #container{ display: flex; position: relative; flex-flow: row wrap; width: 100%; } The goal is to add more divs to the cont ...

What causes an absolutely positioned element to be positioned by its sibling rather than at the top corner of the page?

Can someone explain to me why my absolutely positioned element is displaying after my child_static div? I'm under the impression that absolutely positioned elements are removed from the normal flow. So why isn't child_absolute covering the child_ ...

How to Align col-md-5 in the Center Using Bootstrap?

Is anyone else struggling with this dilemma or is it just me? I've been searching everywhere for a solution to my problem but I can't seem to find one. According to the grid system, if you have a column size of col-md-5, centering it should be ...