Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

align textblock 1

Status
Not open for further replies.

lin73

Programmer
Feb 17, 2006
110
0
0
SE
I have 2 textblocks like this...

text1 somevalue
mytext2 somevalue
mytxt3 someothervalue


Is it possible to align the "somevalue" column so it looks like this..

Code:
text1     somevalue
mytext2   somevalue
mytxt3    someothervalue


 
I notice that you've asked nearly 50 questions and haven't yet answered any questions from other people. Of all the answers given to you, you have only marked one as being valuable. You may need to read faq222-2244 carefully to see why you are not getting valuable answers - it's generally because you ask poorly formed or unclear questions.

faq222-2244 will also explain about giving back to the forum, and how to recognise valuable answers.

On the basis of the rather thin info that you've supplied in this question I would use 2 divs floated left.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
I have 2 textblocks like this...

text1 somevalue
mytext2 somevalue
mytxt3 someothervalue

Surely that's 3 "textblocks", anyway?... So like John says, you might want to give better details, such as some real code, for example.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
johnwm

I didn't realize that I have to answer other questions in other posts than the one I myself start, in order to get a reply from this forum. And have you thought about that maybee not all of us speak english as our native language and therefore maybee dont write as good english as you guys that have english as your first language.

Frankly I am very disapointed that people complaing about the way I describe the problem, maybee I'm not as good as you others in writting english.

I will probably get banned from this forum now after this being said, but that is fine, there is plenty of other forums that doesn't complain about poorley described problems.
 
Hi

Dan said:
give better details, such as some real code, for example
If your English knowledge is weak, then why not post some code ? Spreading six words as example in your request will not help us understand how you want to organize them.

And yes, if you want to be treated as a member of the community is not enough to just ask. Answering other peoples' questions does not necessary mean to express your thoughts in English sentences. You can just post code to solve their problem.

Feherke.
 
lin73, what have you tried so far?
Do you have two blocks with block 1 being text1 mytext2 mytext3?

Or if your data is simply matched pairs of values, then a table may be what you are looking for.

A little more information will allow us to help you to find a reasonable solution.

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Well to provide some code is not that easy when I don't have any code that I use so far. And I thought that I explained it well when I provided the text. If you compare how the 3 "Somevalue" text are aligned you see that the ones in the "code" example are aligned under each other, but the other "somevalues" are not. Since I don't have a clue on how to do that with css, I have not made any css code yet and can therefore not provide any.
 
traingamer

I will go with a table and do it "old school", I just hopped it would be a way to do this with css and save some space. Thanks for helping and not being rude regarding the way I try to describe the problem.
 
You really didn't provide enough info for a simple answer.

I've attached an example solution using three separate methods.
The first is a simple table - it breaks down when you have long text in your value column. (If you always have short text, this may not be a problem for you.)

The second uses divs as text blocks. I've added line breaks to allow the data to line up. This too would fail spectacularly if you had long lines of text (and has the added anoyance of the line breaks). I wouldn't use this.

The third way adds a span to the markup, and may or may not be a solution for you.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <meta http-equiv="content-language" content="en"/>
    <title>Test Harness</title>
    <style type="text/css">
.ident { 
width: 20%;
float: left;
}
.values { 
float: left;
}
.thirdmeth p {
clear: both;
float left;
}
.thirdmeth p span {
width: 20%;
float: left;
color: red;}
    </style>
<body>
<table>
<tr><td>text 1</td><td>somevalue</td></tr>
<tr><td>text 2</td><td>somevalue</td></tr>
<tr><td>mytext3</td><td>some other value some other value some other 
value some other value some other value some other value some other value
value some other value some other value some other value some other value
value some other value some other value some other value some other value
</td></tr>
<tr><td>mytext 4</td><td>somevalue</td></tr>
</table>

<div class="ident">text 1</br>text 2</br>mytext3</div>
<div class="values">somevalue</br>somevalue</br>somevalue</div>

<div class="thirdmeth">
<p><span>text 1</span>somevalue</p>
<p><span>text 2</span>somevalue</p>
<p><span>text 3</span>some other value some other value some other 
value some other value some other value some other value some other value
value some other value some other value some other value some other value
value some other value some other value some other value some other value</p>
<p><span>text 4</span>somevalue</p>
</div>
</body>
</html>
A clear statement of your problem would likely provide a quicker better solution...

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Hi

The third method works fine for me and this was just what I wanted to do, thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top