user1708364
user1708364

Reputation: 11

align div whith background image

I just want align the background with my div where I have the text.

I have this code: (Please, resize the window for see the effect) http://jsfiddle.net/BcqLK/

.texto1Home{ 
  width: 48.1%;
  color: #58585A;
  font-weight: 700;
  line-height: 100%;
  text-align: center;
  float: left;
  border: solid 1px red;
  position: absolute;
  display: inline-block;
  top: 13.75%;
  left: 25.75%
}

And I want this result: (is an image) http://jsfiddle.net/qYVL4/

Upvotes: 1

Views: 53

Answers (1)

Vanchev
Vanchev

Reputation: 1584

Try this out:

[EDIT] http://jsfiddle.net/BcqLK/6/

Basically you annotate the container with:

position:relative 

After that position the rest of the content with an absolute positioning inside the container. Also I didn't use % but pixels for the positioning. Also it is important to set static image size, otherwise you should really use % or something like that for the alignment.

Regards

Upvotes: 2

Related Questions