Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: css image alignment
jameslomax wrote #288238:
Hi folks. None of this has worked / I don’t quite know how to do it. To clarify: what I want is the long photo displayed 100% but centered.
Is this what you need? That’s done with what I suggest above. Tested in recent firefox and chrome on w7, maybe you have another setup.
Offline
Re: css image alignment
Thank you for your patience.
Yes! – that’s what I want etc.
I tried inserting that code but it didn’t work. If you could perhaps specify where it goes, and what it should delete, it seems the problem is solved for the image. Although I’m not sure if it will alter the text underneath the photo, which is not what I want.
(This is not a “language” I can speak. I’m basically guessing).
Offline
Re: css image alignment
jameslomax wrote #288249:
If you could perhaps specify where it goes, and what it should delete, it seems the problem is solved for the image. Although I’m not sure if it will alter the text underneath the photo, which is not what I want.
You should add these rules after (or at the end of) your css p#single-photo
block, or append !important
to make sure they are not overwritten:
#single-photo {
left: 50% !important;
margin-left: -100% !important;
}
The text will not be concerned, it is contained in a separate div
. If you are comfortable with dev tools, click “Inspect element” and add these rules in the css pane, just to check if it works in your browser. Hope that helps.
Offline
#16 2015-02-13 22:40:03
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: css image alignment
I think it would be better if you rethink the structure of the page. Your main container, #page, is 820 pixel width. #wrapper and #photo-wrapper are 726 pixel width, but the inside #single-photo is 1226 pixel width. It would be better if your main container had at least this 1226 pixel width and then you organize the other divs according to this width.
This in case that you want to work with fixed widths.
Offline
Re: css image alignment
OK thanks, done that and it seems to solve the image alignment. However, when there’s text underneath a photo this is now what happens
Last edited by jameslomax (2015-02-14 13:57:56)
Offline
Re: css image alignment
jameslomax wrote #288268:
OK thanks, done that and it seems to solve the image alignment. However, when there’s text underneath a photo this is now what happens
Ah, this text. It should be put in a separate <p>
after <p id="single-photo">
, I think. Can not think of a better solution right now, sorry.
Offline
Re: css image alignment
OK. I can follow that.
But when you say “It should be put in a separate <p> after <p id=“single-photo”>”
- what exactly is the code for that?
If that works, it seems the problem is solved.
Offline
#20 2015-02-15 18:10:01
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: css image alignment
The image given in your post doesn’t allow us to see your HTML.
And don’t forget: Your brain can learn, don’t limit yourself to constant asking and asking and copy codes you don’t understand.
Offline
Re: css image alignment
I’ve been trying (and posting here) for 10 years ;-)
I’m happy to provide HTML or anything else if I can. I thought this was about the css, which can be seen in a browser?
Offline
#22 2015-02-15 20:42:57
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: css image alignment
It seems to me that we are not talking about the page of your initial question. Or which text needs its own paragraph?
Offline
Re: css image alignment
Correct. I provided a screen shot showing the problem.
This is the code I’m using:
div#photo_wrapper {
text-align:center;
}
p#single-photo {
margin: 25px auto 0 auto;
text-align: justify;
position: relative;
display: inline-block;
overflow: hidden;
}
#single-photo {
left: 50% !important;
margin-left: -100% !important;
}
According to etc it seems that somewhere in there, I need to insert a <p> to separate the text from the photo. I don’t know how to do that.
Offline
#24 2015-02-16 16:39:07
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,473
Re: css image alignment
The help of etc is an instant solution, but it’s better, not to take out the #single-foto from your main wrapper, see here.
Can you show the code you’re working on. It seems to me that we are not talking about your initial example.
Offline