css - Center div with position absolute? -


i wondering how center div.

https://jsfiddle.net/eljy45zq/

i tried adding auto margin won't center on screen.. want responsive. didn't want add fixed width because want border top/bottom line match length of word. also, there way can make top , bottom lines double?

   .name {   font-family: 'pt sans', sans-serif;   font-size: 80px;   border-top: 1px solid black;   border-bottom: 1px solid black;   position: absolute;   margin-left: auto;   margin-right: auto; } 

.wrapper {     position: fixed;     top: 30px;     left: 0px;     width: 100%;     text-align: center; }  .name {   font-family: 'pt sans', sans-serif;   font-size: 80px;   border-top: 1px solid black;   border-bottom: 1px solid black;   display: inline-block;        } 

https://jsfiddle.net/eljy45zq/2/

create wrapper , use display: inline-block; lines work how want them.

(added position: fixed wrapper, change needed)


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -