Hi,
I am working on something where I need to display an element on the top of a page centered. I have put some HTML together shown below:
<html>
<head>
<style type="text/css">
body {
background: #c0c0c0;
}
.test {
padding: 5px 27px 3px 5px;
background: #fff;
position: absolute;
top: 0;
left: 50%;
margin-left: -75px;
}
.arrow {
height: 17px;
width: 17px;
background: #f00;
position: absolute;
top: 6px;
right: 4px;
}
</style>
</head>
<body>
<div class="test">
THIS IS SOME TEST DATA
<div class="arrow">
</div>
</div>
</body>
</html>
What I am trying to do is when the text expands the div expands from left and right outwards. At the moment if i enter more than just ‘THIS IS SOME TEST DATA’ it expends from the right. Can I achieve this?
If you use the above markup, you will see a red box. This will be an arrow but I have used this just as an example. That red box will always need to remain on the right of the text…
Thanks