HTML/CSS - Automatically adjust size of element for different screen size(s)
You can set your width using relative percentage, such as 50%, the actual width will be 50% of the parent width. To center the absolute header, you can set its left and right to 0 and margin:0 auto: #header{ position: absolute; top: 10%; left:0; right:0; margin:0 auto; width: 50%; height: 100px; border:thin solid black; text-overflow:ellipsis; overflow:hidden; }