2

I'm trying to "clone" the TOC from this google-codelabs page here: https://codelabs.developers.google.com/codelabs/cloud-app-engine-aspnetcore

So far, it works perfectly in Google-Chrome and Firefox.
But Internet Explorer (11)... Juddging from Item 3, it seems like IE doesn't properly align the bullet vertically in the middle.
Why ?
How can I properly align the bullet and the text vertically in the middle in IE 11 ?

the problem

This is what I have (or see fiddle):

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />

    <meta charset="utf-8" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <meta http-equiv="Content-Language" content="en" />
    <meta name="viewport" content="width=device-width,initial-scale=1" />

    <meta name="google" value="notranslate" />
    <title>Simple Page</title>

    <style type="text/css" media="all">

        html, body
        {
            width: 100%; height:100%;
            margin: 0px; padding: 0px;
        }


        body
        {
            background-color: #0c70b4;
            color: #546775;
            font: normal 400 18px "PT Sans", sans-serif;
            -webkit-font-smoothing: antialiased;
        }





        .googleblue
        {
            background-color:#1E88E5;
        }

        .bgLeft
        {
            background-color: #F5F5F5;
        }

        .bgRight
        {
            background-color: #E0E0E0;
        }


        .googlefontgray_line
        {
            color: #777777;
        }
    </style>


</head>
<body class="bgLeft">

    <style>

        .paper-item-0
        {
            display: -ms-flexbox;
            display: -webkit-flex;
            display: flex;
            -ms-flex-direction: row;
            -webkit-flex-direction: row;
            flex-direction: row;
            -ms-flex-align: center;
            -webkit-align-items: center;
            align-items: center;
            font-family: 'Roboto', 'Noto', sans-serif;
            -webkit-font-smoothing: antialiased;
            font-size: 16px;
            font-weight: 400;
            line-height: 24px;


            position: relative;
            min-height: 48px;
            padding: 0px 16px;
            border: 1px solid hotpink;
        }

        .toc-item
        {
            font-size: 14px;
            color: #9e9e9e;
            overflow: hidden;
            border-radius: 4px;
            padding: 6px 16px;
            box-sizing: content-box;
        }



        .bulletStyle
        {
            display: inline-block;
            font-style: normal;
            width: 24px;
            min-width: 24px;
            background-color: #fff;
            border-radius: 50%;
            text-align: center;
            height: 24px;
            vertical-align: middle;
            line-height: 24px;
            border: 2px solid #bdbdbd;
            margin-right: 8px;
            font-weight: 400;
        }


        .lineAbove::before
        {
            position: absolute;
            top: 0px;
            left: 30px;
            bottom: calc(50% + 12px);
            content: '';
            display: block;
            border-left: 1px solid #bdbdbd;
            #width: 0;
            #height: 44px;
            z-index: 1;
            #margin-top: 1px;
            #margin-left: 11px;
        }

        .lineBelow::after
        {
            position: absolute;
            top: calc(50% + 12px);
            left: 30px;
            bottom: 0px;
            content: '';
            display: block;
            border-left: 1px solid #bdbdbd;
            #width: 0;
            #height: 44px;
            z-index: 1;
            #margin-top: 1px;
            #margin-left: 11px;
        }

        /*
        .lineAbove::before
        {
            border-color: #2196f3;
        }
        */

        .tocText
        {
            font-size: 14px;
            color: #9e9e9e;
            padding: 6px 16px;
        }

    </style>


    <paper-item class="toc-item paper-item-0" role="option" tabindex="0" aria-disabled="false" aria-selected="true">
        <i class="bulletStyle #lineAbove lineBelow">1</i>
        <span class="tocText">Overview</span>
    </paper-item>

    <paper-item class="toc-item paper-item-0" role="option" tabindex="-1" aria-disabled="false">
        <i class="bulletStyle lineAbove lineBelow">2</i>
        <span class="tocText">Setup and requirements
            <br />Line 1
            <br />Line 2
            <br />Line 3
            <br />Line 4
            <br />Line 5
            <br />Line 6
        </span>
    </paper-item>


    <paper-item class="toc-item paper-item-0" role="option" tabindex="-1" aria-disabled="false">
        <i class="bulletStyle lineAbove lineBelow">3</i>
        <span class="tocText">foo</span>
    </paper-item>



    <a class="toc-item paper-item-0" role="option" tabindex="-1" aria-disabled="false">
        <i class="bulletStyle lineAbove #lineBelow">4</i>
        <span class="tocText">foo</span>
    </a>



</body>
</html>
  • IE11 screen https://yadi.sk/d/sHOZamgd3EBykb – grinmax Feb 17 '17 at 07:44
  • Everything you need to know about aligning items centrally: http://stackoverflow.com/questions/19461521/how-to-center-an-element-horizontally-and-vertically – nashcheez Feb 17 '17 at 07:51
  • Possible duplicate of [How to center an element horizontally and vertically?](http://stackoverflow.com/questions/19461521/how-to-center-an-element-horizontally-and-vertically) – Option Feb 17 '17 at 08:01

2 Answers2

1

try this code:

<paper-item class="toc-item paper-item-0" role="option" tabindex="0" aria-disabled="false" aria-selected="true">
    <i class="bulletStyle #lineAbove lineBelow">1</i>
    <span class="tocText">Overview</span>
</paper-item>

add this code to paper-item tag

paper-item
{
 display:flex;
 align-items: center;
}
mr100
  • 4,340
  • 2
  • 26
  • 38
1

Change box-sizing: content-box; to box-sizing: border-box; in the .toc-item rule

Updated fiddle

.paper-item-0 {
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
  -ms-flex-direction: row;
  -webkit-flex-direction: row;
  flex-direction: row;
  -ms-flex-align: center;
  -webkit-align-items: center;
  align-items: center;
  font-family: 'Roboto', 'Noto', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  position: relative;
  min-height: 48px;
  padding: 0px 16px;
  border: 1px solid hotpink;
}

.toc-item {
  font-size: 14px;
  color: #9e9e9e;
  overflow: hidden;
  border-radius: 4px;
  padding: 6px 16px;
  box-sizing: border-box;
}

.bulletStyle {
  display: inline-block;
  font-style: normal;
  width: 24px;
  min-width: 24px;
  background-color: #fff;
  border-radius: 50%;
  text-align: center;
  height: 24px;
  vertical-align: middle;
  line-height: 24px;
  border: 2px solid #bdbdbd;
  margin-right: 8px;
  font-weight: 400;
}

.lineAbove::before {
  position: absolute;
  top: 0px;
  left: 30px;
  bottom: calc(50% + 12px);
  content: '';
  display: block;
  border-left: 1px solid #bdbdbd;
  #width: 0;
  #height: 44px;
  z-index: 1;
  #margin-top: 1px;
  #margin-left: 11px;
}

.lineBelow::after {
  position: absolute;
  top: calc(50% + 12px);
  left: 30px;
  bottom: 0px;
  content: '';
  display: block;
  border-left: 1px solid #bdbdbd;
  #width: 0;
  #height: 44px;
  z-index: 1;
  #margin-top: 1px;
  #margin-left: 11px;
}


/*
        .lineAbove::before
        {
            border-color: #2196f3;
        }
        */

.tocText {
  font-size: 14px;
  color: #9e9e9e;
  padding: 6px 16px;
}
<paper-item class="toc-item paper-item-0" role="option" tabindex="0" aria-disabled="false" aria-selected="true">
  <i class="bulletStyle #lineAbove lineBelow">1</i>
  <span class="tocText">Overview</span>
</paper-item>

<paper-item class="toc-item paper-item-0" role="option" tabindex="-1" aria-disabled="false">
  <i class="bulletStyle lineAbove lineBelow">2</i>
  <span class="tocText">Setup and requirements
            <br />Line 1
            <br />Line 2
            <br />Line 3
            <br />Line 4
            <br />Line 5
            <br />Line 6
        </span>
</paper-item>


<paper-item class="toc-item paper-item-0" role="option" tabindex="-1" aria-disabled="false">
  <i class="bulletStyle lineAbove lineBelow">3</i>
  <span class="tocText">foo</span>
</paper-item>



<a class="toc-item paper-item-0" role="option" tabindex="-1" aria-disabled="false">
  <i class="bulletStyle lineAbove #lineBelow">4</i>
  <span class="tocText">foo</span>
</a>
Abhishek Pandey
  • 13,302
  • 8
  • 38
  • 68
Asons
  • 84,923
  • 12
  • 110
  • 165