rjcarr
rjcarr

Reputation: 2091

Positioning and Overflow with CSS

Here is my jsfiddle:

http://jsfiddle.net/Xz3SH/

This is what i wanted to do:

  1. On the right element, I'd like the "Close" text to be vertically centered.
  2. On the main element, I'd like the lorem text to not overflow into the right.

Note the outer element has fixed position on purpose. Here's what I've tried:

Here's some CSS to satisfy the submission parser:

#panel-notice > p#close {
  display: inline-block;
  vertical-align: middle;
}

#panel-notice > p#message {
  display: inline-block;
  overflow: hidden;
}

EDIT: I should note, in case it wasn't clear, that the lorem text could be any height including one line.

Upvotes: 0

Views: 83

Answers (2)

Mehar
Mehar

Reputation: 2238

You are using position: absolute; width the #close div so use top:50% to make it center. and in second point you should have to specify the with to the #message div to overcome overflow issue

Here's the demo demo

Upvotes: 0

Andrei Terecoasa
Andrei Terecoasa

Reputation: 572

#panel-notice {display:table}

#panel-notice > p#close {display:table-cell; float:right;}

remove position:absolute and just put #panel-notice > p#close after p#message in html:)

Upvotes: 1

Related Questions