3 replies [Last post]
wiklander79
Offline
Regular
Last seen: 13 years 44 weeks ago
Joined: 2007-02-01
Posts: 11
Points: 0

Ok here we go again.. (just wana say that I do test and test befor I post, Almost fell like I post 2 whenever I have a problem.

The problem: How ca I manipulate the text alignment in divs?
Adding a pic down. I'm working on a menu, How can I v-align the text in the buttons? is that possible? Do I have to use another div to make that happen??

CSS code:

html, body { height: 100%; background-image:url(images/backtest.jpg); float:left; margin: 0px 0px 0px 0px}

.container
{ height:100%; width:100%;

}

.mupp {margin-top:90px; margin-left:10px; height:32px; width:900px; padding:0px; margin-bottom:0px;}

#menybox ul
{

height:32px;
list-style-type: none;
float: left;
width: 400px;
padding: 0;
margin: 0;
border: 0px;

font: 12px Tahoma, Arial, Helvetica, sans-serif;
font-weight: bold;
}

#menybox li { display: inline; }

#menybox a, #menybox span
{

height: 32px;
float: left;
width:73px;
padding:0;
text-align:center;
background-image:url(images/meny3.gif);
background-repeat:no-repeat;
color:#333333;
text-decoration: none;
}

#menybox a:hover, #menybox span#aktuell
{

background-image:url(images/meny4.gif); color:#333333;
}

.main {margin-left:10px; height:400px; width:900px; background-color:#FFFFCC}

HTML code:

CSS Utbildning

  • Steg1
  • Steg2
  • Steg3
  • Steg4
  • Steg5

jkfhsdfk

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 week 1 day ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Generally your text should

Generally your text should not even be in DIVs. Normal text belongs inside P elenments.

DIV is a grouping element and should be used for that alone as much as possible since it's syntactical meaning is weak.

In your code above it looks to me like should be a P element with an ID of "main" unless there will be several paragraphs, in which case it might be appropriate to group them with an enclosing DIV.

You are really designing backwards here. You should have your content already in your file and marked up semantically before you try to do your layout. You shouldn't even be thinking of making it look any particular way until the content is properly marked up.

Yeah, I know no one except me does that and often I don't even do it completely, but we could save ourselves so much trouble by following the correct development sequence.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

ClevaTreva
ClevaTreva's picture
Offline
Guru
A hilly place, UK
Last seen: 2 years 11 weeks ago
A hilly place, UK
Joined: 2004-02-05
Posts: 2902
Points: 0

If you make the ul have a

If you make the ul have a height

The a link give a line-height (same as the ul height) and vertical-align:middle

Should do the job

[edit]of course, the buttons should be an unordered list, not divs.

wiklander79
Offline
Regular
Last seen: 13 years 44 weeks ago
Joined: 2007-02-01
Posts: 11
Points: 0

Yes I know I might be doing

Yes I know I might be doing it thw wrong way.. But I am still very much in the learning state, and therfore I need to do alot of trying and trying.

When I have a litte better understanding of how the CSS works and how you go about to get everything where it is supposed to be the I can try to do it in a right way.

TAnks for the help guys, the line-height did the trick,