Log in

View Full Version : Absolute positioning text



Black Roses Burn Brightly
05-18-2005, 10:15 PM
Can anyone provide me with a code for absolute positioning of text? Thanks :)

darco9x2
05-19-2005, 02:27 AM
absolute? like <center> but on side? where do you want to position it?

Black Roses Burn Brightly
05-19-2005, 08:39 PM
well there's an absolute position code for positioning images or other things by the number of pixels from the left and top, but it doesn't seem to work for text, is there a way to get text positioned that way?

mwinter
05-19-2005, 09:04 PM
well there's an absolute position code for positioning images or other thingsThese are all elements, and the only things that can be addressed through CSS selectors. That is, you don't position an image, but you do position an img element. Likewise, you can't position text, but you can position an element which contains text, such as a p or span element.


by the number of pixels from the left and topThere are a variety of units that can be used for positioning, not just pixels. Similarly, elements can be offset from the right or bottom, or may not involve offsets at all (in the case of floats).


but it doesn't seem to work for textDo you mind showing an example of what you're trying to do, and perhaps what you've tried so far?

Mike

Black Roses Burn Brightly
05-20-2005, 02:24 AM
Well I don't exactly have an example because I can't seem to get it working, but I can explain to you in a simple way what I am trying to do...I have a row of pictures that are linking to pages, and I want a link to be under each picture, but I can't find a way to do that, and another row of pictures to start a few spaces below the links...I can do that part, I'm just telling you what I'm trying to do...So basically I just need to get some text under some pictures, that's the simplest way I can put it. Thanks.

mwinter
05-20-2005, 10:29 AM
Well I don't exactly have an example because I can't seem to get it workingI wasn't looking for a working example (you wouldn't be asking for help if you had one :)), but posting (preferably a link to) something can identify misconceptions that you might have. Moreover, it can be simpler to alter an existing example rather than writing something from scratch.


I have a row of pictures that are linking to pages, and I want a link to be under each picture [...]So you're referring to captions? You should be able to find examples in various places, but it's not that complex. All you need to do is use a container to group each image/caption pair. When you want to position these groups, you do it with respect to the container, not the image or the text.


<div class="image-container">
<img alt="" src="...">
<p>Your caption.</p>
</div>You can then style these containers, and their content, as you see fit. How you position them is up to you, but floating them is probably best.

If you want a more complete example, I'd need some sample content. It's a bit difficult to demonstrate a layout when I don't know what I'm laying out.

Mike

techhietim
05-26-2005, 04:21 PM
If your heart isn't set on learning CSS to do pixel-level positioning, it's faster and easier to lay your pictures out in a table. You can place the image in a <td>, then use <br> to drop beneath the picture to enter its caption. For best results, use the height and width attributes to keep your pictures uniform and keep the table nice and neat.