Search code examples
htmlcssalignment

How can I set the correct position of the text in CSS?


I have the following css code:

#content{
  position: fixed;
  bottom: 21px;
  text-align: right;
}

#content h1{
  font-size: 1.5vw;
  text-align: right;
}

and html:

<html>
    <head>
    </head>            
    <body>
        <div id="content">
            <h1>content</h1>
        </div>
    </body>
</html>

here's jsfiddle. I cannot make the text to be displayed on the right side, it's only on the left side... How can I fix it? Thanks.


Solution

  • Set container's (#content) width css property to 100%.

    JSFiddle