- This topic is empty.
-
AuthorPosts
-
November 24, 2015 at 6:17 pm #235198ThomasAJParticipant
I have an example http://jsfiddle.net/ThomasAJ/0eeb3j5e/1/
Squeeze the Result horizontally and you will see…
- The days are responsive.
- Totally ignore the green line please as that will be taken care of by server side coding.
The challenge is to make the text “Tom Jones – $4,000” responsive also.
Can this be done via CSS and maybe JS as well?
November 24, 2015 at 9:58 pm #235202ThomasAJParticipantBy ‘responsive text’ I am not referring to resizing text.
When the container is narrowed the text spills outside the first line of days. I want it to follow onto the second line of days.
I strongly suspect it cannot be done by CSS alone but needs some clever JS.
November 24, 2015 at 11:06 pm #235205pm4698ParticipantI suppose that your example is the table correct?
If yes, then you should place IDs or classes to td elements.
Then inside your css file, you use the @media to set your desired responsiveness.
Now, normally (for example for @media min-width: around 700 px you should be ok. For @media max-width: around 420px which is the mobile version you set in td class of the table width: 100%;
So:
1st step: inside your css you place wraps like this:@media screen and (min-width: XXXpx) { }
where XXX the desired width you want your appearance to change. Inside the brackets you place your CSS coding like this:
div.day-wrapper{width:100%;}If you do this in normal CSS, then you see the result. So, you just need to tell CSS to show this result at specific screen width.
So, in you css file you may use something like this:
…
@media screen and (max-width:420px) {
div.day-wrapper{width:100%; }
.day-wrapper{width:100%;}
.day-weekday{width:100%;}
}
…Add inside those brackets whichever element you want to fill the screen by adding width:100%;
Sometimes, you need to use this: 100%!important; to override some other CSS
November 24, 2015 at 11:38 pm #235207ThomasAJParticipantThank you pm4698 for responding. However I am not sure where you are seeing table/s in my jsfiddle as there is none. Or do I misunderstand you?
As per my jsfiddle, as the container is narrowed, one day at a time goes to the second row.
I need my text to follow.
November 25, 2015 at 12:09 am #235208pm4698ParticipantSorry, it looked like table but its divs.
Although my proposed code works. Please check
November 25, 2015 at 12:20 am #235209ThomasAJParticipantSorry again but your code is not what i am after. Please have a look at SO post http://stackoverflow.com/questions/33907259/how-to-make-responsive-text
As it has a good image to show the result I am after.
November 26, 2015 at 8:55 am #235270ShikkedielParticipantAs far as I got with it…
November 27, 2015 at 1:58 pm #235325ThomasAJParticipantThanks Dhikkediel.
I have not had a chance to have a good look at it.
November 28, 2015 at 2:01 am #235335ShikkedielParticipantTo summarise,
word-break: break-all
seems to be the best approach. Using absolute positioning andline-height
here to get the text in the correct place. Wrapping of the overflow I’ve left tocalc()
but that’s only approximate, to do this in a more accurate way would require JS I believe. -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.