t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

Icon overlaps content if using custom content without text #842

Open ocastadaniel opened 6 years ago

ocastadaniel commented 6 years ago

If you set the content option to a custom element, without text or a title, but you do add an icon, the icon overlaps the content.

Example here in jsfiddle

https://jsfiddle.net/spyrnx35/11/

var div = document.createElement('div');
var content = document.createTextNode("Hello world, this get's overlapped");
div.appendChild(content);
swal({
    icon: 'success',
    content: div
  });

outputs as follows:

screen shot 2018-06-11 at 11 09 02

maliming commented 4 years ago

hi @ocastadaniel
I think you can try div.style = 'position: relative;';

var div = document.createElement('div');
div.style = 'position: relative;';
var content = document.createTextNode("Hello world, this get's overlapped");
div.appendChild(content);
swal({
    icon: 'success',
    content: div
  });