Is there a "+" symbol positioned at the center of a div with a border-radius of 50%?

I need help centering a + symbol inside a div. It's displaying differently on iOS compared to Chrome, with the icon appearing lower in the div on iOS. Any suggestions for fixing this issue?

Fiddle

.addplus {
  border-radius: 50%;
  background-color: blue;
  width: 38px;
  height: 38px;
  margin: 5px;
  color: #fff;
  font-size: 38px;
  float: left;
  text-align: center;
  line-height: 38px;
  font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
}
<div class='addplus'>
  +
</div>

Answer №1

Unfortunately, I don't have access to an IOS device at the moment to verify if this solution works. However, you can give it a try:

Enclose the "+" symbol within a span tag and then center align the span within the div.

You can do something like this:

.addplus {
  position: relative;
  border-radius: 50%;
  background-color: blue;
  width: 38px;
  height: 38px;
  margin: 5px;
  color: #fff;
  font-size: 38px;
  float: left;
  text-align: center;
  line-height: 38px;
  font-family: Helvetica Neue,Helvetica,Arial,sans-serif;
}

.plus {
  position: absolute;
  color: #fff;
  font-size: 38px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
<div class="addplus">
  <span class="plus">+</span>
</div>

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

Use jQuery to place the initial 3 elements within a div

Currently, I am dynamically pulling content into li elements using ASP.NET. My goal is to wrap a specific div class around the first 3 li items in the list only. Here is an example: <ul class="wrapper"> <div cl ...

Icons are now toggling for all items, not just one

Within my Angular 2 application, I have implemented a collapsible and expandable menu. The issue I am facing is with the toggling of icons - when expanding one menu item, the icon changes correctly but it also changes for all other menu items that are not ...

Problems revolving around the fundamental CSS drop-down menu concept

I'm struggling to center a CSS drop-down menu on my webpage without causing the drop-down effect to break. No matter what I try, it seems to mess up. What am I missing? Snippet of code: html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,b ...

The problem with maintaining a 100% height background image size is persisting

After making progress on the background of my new website, I've hit a roadblock. The background image shrinks to less than 100% height when the browser window is resized. I need the background image to remain full size at all times, without the heigh ...

Creating a personalized, perfectly centered container with a specific width in Twitter Bootstrap

I've been struggling with a unique challenge for the past day without success. I can't seem to figure out where I am making a mistake. My goal is to design a fixed container layout using Bootstrap, which is precisely 33em wide and horizontally c ...

I'm confused as to why my modal isn't appearing when the page loads

Recently, I've taken up coding as a hobby. However, I've encountered an issue with my modal not popping up on page load. Strangely, it works perfectly fine when I open a blank document but fails to load on my friend's homepage. I am using Dr ...

Ways to match a string against a numeric value

I have a span id with textContent which have their own time(hour/minutes) <div class="here"> <span class="time" >8 min</span> </div> <div class="here"> <span class="time" >22 min&l ...

Blend element in CSS

Is it possible to achieve something like the following using only CSS? h* + p { color: red; } Instead of h1 + p, h2+p... { color:red; } I haven't found a solution yet, any suggestions would be appreciated. Thank you! ...

Aligning two divs both horizontally and vertically within two adjacent columns each with a width of 50%

Struggling to align two divs both vertically and horizontally within their respective parent containers that are placed side by side with 50% width and 100% height? Check out my solution on Codepen for reference. View Codepen Example *** HTML *** <di ...

How can I extract the page's output using JQuery?

Being a rookie in this area, I am eager to learn how to extract specific content from a page using AJAX in JQuery. Currently, I have been able to fetch the data of a page and display it as text: $.ajax({ type: "POST", url: "myfile.html", su ...

What is the process for printing a page in plain text format on a matrix-dot printer?

I've come across many similar questions on SO about this issue, and I've tried various solutions without success. I'm using an Epson LX300+II printer and I want to print pages from my web application in a plain format, like how it would look ...

What could be the reason for my Angular Material CSS file not functioning correctly?

After creating an HTML file using Angular Material, I noticed that the components' CSS files are not being applied properly. This is a snippet from my HTML file: <div class="content-container"> <div class="tree-container&quo ...

"Adding a touch of magic to your website with hover effects

I need help with creating a hover effect on my website similar to the one seen here: ...

What could be causing the uneven application of CSS padding when it is applied to a div that serves as the parent of an HTML form?

Padding has been added only to the top and bottom of a div. The padding attribute is displaying consistently for the form element, however, it is not behaving uniformly for the parent div of the form as illustrated in the image provided below. Output:- h ...

What could be causing my modal to not animate from the center of the screen?

I am aiming to have my .modal div class smoothly scale from 0 to 1 right in the center of the screen instead of starting at the bottom right and then moving to the center before settling in its final position. I have checked various resources like MDN docu ...

Ways to enhance widget titles with borders on Blogger

As a Blogger user, I am looking for guidance on how to add a border around the title of each widget/gadget. When I place widgets such as About Me, Follow Us, etc., in my sidebar, I want them to have borders like in this image. While I know how to customize ...

Troubles with flexibility in image placement

I am working on adjusting my design to accommodate smaller screen sizes where elements may shift to a second line. I want these elements to align to the left instead of being centered. The image below illustrates my goal: https://i.sstatic.net/CzX5V.png C ...

My element's padding being overlooked by Tailwind CSS

In the process of developing a comment/response mechanism through MPTT, I am utilizing indentation to clearly designate replies and their respective levels. The comment.level attribute is being employed to establish the padding value. Consequently, a comm ...

What exactly does white space signify during the inspection process?

For quite some time now, I've been experiencing a strange problem with webpack. The layout in Dev seems to be slightly different than the build. While inspecting in Firefox, I noticed that the difference lies in the white space. My question is, what e ...

Why is the child element appearing on top of another element even though it has a lower

Today, I decided to dive into z-index and experiment with it. However, I am having trouble understanding the behavior. Below is a simplified version of the HTML structure: // content has z-index of 30, pos abs <div class="content"> // content-c ...