Text over image in JCE
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Sun May 18, 2008 10:01 pm
Text over image in JCE
Hi guys, is there a way to easily add large white text over an image added in JCE.
Rather than a description, more of a title at the very center of the image.
Thank you.
Rather than a description, more of a title at the very center of the image.
Thank you.
- cms-4all
- Joomla! Apprentice
- Posts: 17
- Joined: Tue Oct 02, 2012 4:38 pm
- Location: Hamburg
- Contact:
Re: Text over image in JCE
Hi,
that´s easy:
Adding large white text over an image in Joomla using the JCE Editor can be achieved in a few straightforward steps. Here’s how you can do it:
1. **Upload and Insert the Image**:
- Open the JCE Editor where you want to add the image.
- Click on the “Image” icon to open the image manager.
- Upload your image if it isn't already uploaded, then select the image and click on the “Insert” button.
2. **Add a Text Layer Over the Image**:
JCE does not natively support adding text directly on images. You will need to use a workaround by creating a layer over the image or using custom HTML/CSS:
**Option A: Using a Module or Custom HTML**
- You can use a Joomla module that supports text overlays such as a slideshow or custom HTML module. These modules allow you to place text over images and position it accordingly.
- Install and use a module where you can insert both text and images, and position the text over the image.
**Option B: Using Custom HTML and CSS**
- Go back to your article or custom module and switch to HTML view in JCE.
- Add the following HTML and CSS snippet around your image code:
----------------------
<div style="position: relative; text-align: center; color: white;">
<img src="your-image-url.jpg" alt="Descriptive Text for Image" style="width: 100%;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 24px; color: white;">
Your Title Here
</div>
</div>
----------------------
- Replace `"your-image-url.jpg"` with the URL of your image.
- Adjust `"Your Title Here"` with your desired text.
- Modify the `font-size` and other styles to suit your preferences.
3. **Preview and Adjust**:
- Save your changes and preview the article or module to ensure the text appears as desired over the image.
- Adjust the CSS styles if needed to better center the text or change its appearance.
Best,
Jan
that´s easy:
Adding large white text over an image in Joomla using the JCE Editor can be achieved in a few straightforward steps. Here’s how you can do it:
1. **Upload and Insert the Image**:
- Open the JCE Editor where you want to add the image.
- Click on the “Image” icon to open the image manager.
- Upload your image if it isn't already uploaded, then select the image and click on the “Insert” button.
2. **Add a Text Layer Over the Image**:
JCE does not natively support adding text directly on images. You will need to use a workaround by creating a layer over the image or using custom HTML/CSS:
**Option A: Using a Module or Custom HTML**
- You can use a Joomla module that supports text overlays such as a slideshow or custom HTML module. These modules allow you to place text over images and position it accordingly.
- Install and use a module where you can insert both text and images, and position the text over the image.
**Option B: Using Custom HTML and CSS**
- Go back to your article or custom module and switch to HTML view in JCE.
- Add the following HTML and CSS snippet around your image code:
----------------------
<div style="position: relative; text-align: center; color: white;">
<img src="your-image-url.jpg" alt="Descriptive Text for Image" style="width: 100%;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 24px; color: white;">
Your Title Here
</div>
</div>
----------------------
- Replace `"your-image-url.jpg"` with the URL of your image.
- Adjust `"Your Title Here"` with your desired text.
- Modify the `font-size` and other styles to suit your preferences.
3. **Preview and Adjust**:
- Save your changes and preview the article or module to ensure the text appears as desired over the image.
- Adjust the CSS styles if needed to better center the text or change its appearance.
Best,
Jan
My favorite Joomla components (Meine Joomla Favoriten):
- Virtuemart - Kunena - Community Builder (cb)
Joomla! Agentur Hamburg
- Virtuemart - Kunena - Community Builder (cb)
Joomla! Agentur Hamburg
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Sun May 18, 2008 10:01 pm
Re: Text over image in JCE
That's great, thank you so much. I think option B is the best bet for what I need.
However, is there any way to have so that the text resizes with the image. The image scales to the size of the window, but the text does not at the moment, and stays the same. Thank you.
**Option B: Using Custom HTML and CSS**
- Go back to your article or custom module and switch to HTML view in JCE.
- Add the following HTML and CSS snippet around your image code:
----------------------
<div style="position: relative; text-align: center; color: white;">
<img src="your-image-url.jpg" alt="Descriptive Text for Image" style="width: 100%;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 24px; color: white;">
Your Title Here
</div>
</div>
----------------------
- Replace `"your-image-url.jpg"` with the URL of your image.
- Adjust `"Your Title Here"` with your desired text.
- Modify the `font-size` and other styles to suit your preferences.
However, is there any way to have so that the text resizes with the image. The image scales to the size of the window, but the text does not at the moment, and stays the same. Thank you.
- cms-4all
- Joomla! Apprentice
- Posts: 17
- Joined: Tue Oct 02, 2012 4:38 pm
- Location: Hamburg
- Contact:
Re: Text over image in JCE
To ensure that the text resizes dynamically with the image as the window size changes, you will need to use responsive CSS. This involves setting the font size using viewport units, which scale based on the size of the viewport (the visible area of the web page).
Here's how you can adjust the CSS in your HTML snippet to make the text resize with the image:
Adjusted HTML and CSS
-------------------------
<div style="position: relative; text-align: center;">
<img src="your-image-url.jpg" alt="Descriptive Text for Image" style="width: 100%;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 3vw;">
Your Title Here
</div>
</div>
------------------------
Explanation
- Font Size (`font-size: 3vw`): The font size is set using viewport width units (`vw`). `1vw` is equal to 1% of the width of the viewport. This setting will make the font size adjust based on the width of the screen. For example, `3vw` will make the font size 3% of the viewport width. You can adjust this value to get the desired text size at different screen sizes.
- Image Scaling (`width: 100%`): The image is set to scale to 100% of the width of its container. As the window resizes, the image will scale accordingly, and so will the text because its size is based on the viewport width.
- Test on Various Devices: Preview your page on different devices and screen sizes to ensure the text scales properly with the image. Adjust the `vw` unit as necessary to optimize readability across devices.
- Min and Max Font Size**: Sometimes using `vw` alone can make the text too small on very narrow screens or too large on very wide screens. To handle this, you can use CSS clamps or media queries to set minimum and maximum font sizes:
font-size: clamp(12px, 3vw, 24px);
This example sets the minimum font size to 12 pixels, the preferred size to 3% of the viewport width, and the maximum size to 24 pixels.
Best,
Jan
Here's how you can adjust the CSS in your HTML snippet to make the text resize with the image:
Adjusted HTML and CSS
-------------------------
<div style="position: relative; text-align: center;">
<img src="your-image-url.jpg" alt="Descriptive Text for Image" style="width: 100%;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 3vw;">
Your Title Here
</div>
</div>
------------------------
Explanation
- Font Size (`font-size: 3vw`): The font size is set using viewport width units (`vw`). `1vw` is equal to 1% of the width of the viewport. This setting will make the font size adjust based on the width of the screen. For example, `3vw` will make the font size 3% of the viewport width. You can adjust this value to get the desired text size at different screen sizes.
- Image Scaling (`width: 100%`): The image is set to scale to 100% of the width of its container. As the window resizes, the image will scale accordingly, and so will the text because its size is based on the viewport width.
- Test on Various Devices: Preview your page on different devices and screen sizes to ensure the text scales properly with the image. Adjust the `vw` unit as necessary to optimize readability across devices.
- Min and Max Font Size**: Sometimes using `vw` alone can make the text too small on very narrow screens or too large on very wide screens. To handle this, you can use CSS clamps or media queries to set minimum and maximum font sizes:
font-size: clamp(12px, 3vw, 24px);
This example sets the minimum font size to 12 pixels, the preferred size to 3% of the viewport width, and the maximum size to 24 pixels.
Best,
Jan
My favorite Joomla components (Meine Joomla Favoriten):
- Virtuemart - Kunena - Community Builder (cb)
Joomla! Agentur Hamburg
- Virtuemart - Kunena - Community Builder (cb)
Joomla! Agentur Hamburg
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Sun May 18, 2008 10:01 pm
Re: Text over image in JCE
Hi Jan, many thanks for the reply and the detailed explanation. I really appreciate it.
I can see how that works, thank you.
The only trouble is that these images get displayed in a category blog-styled view, the images get resized and placed at different points, so this would not work for this. Is there a way to do the same thing, but resize dynamically based on the picture size, rather than the window size?
Thank you.
I can see how that works, thank you.
The only trouble is that these images get displayed in a category blog-styled view, the images get resized and placed at different points, so this would not work for this. Is there a way to do the same thing, but resize dynamically based on the picture size, rather than the window size?
Thank you.
cms-4all wrote: ↑Mon Apr 22, 2024 4:36 pmTo ensure that the text resizes dynamically with the image as the window size changes, you will need to use responsive CSS. This involves setting the font size using viewport units, which scale based on the size of the viewport (the visible area of the web page).
Here's how you can adjust the CSS in your HTML snippet to make the text resize with the image:
Adjusted HTML and CSS
-------------------------
<div style="position: relative; text-align: center;">
<img src="your-image-url.jpg" alt="Descriptive Text for Image" style="width: 100%;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 3vw;">
Your Title Here
</div>
</div>
------------------------
Explanation
- Font Size (`font-size: 3vw`): The font size is set using viewport width units (`vw`). `1vw` is equal to 1% of the width of the viewport. This setting will make the font size adjust based on the width of the screen. For example, `3vw` will make the font size 3% of the viewport width. You can adjust this value to get the desired text size at different screen sizes.
- Image Scaling (`width: 100%`): The image is set to scale to 100% of the width of its container. As the window resizes, the image will scale accordingly, and so will the text because its size is based on the viewport width.
- Test on Various Devices: Preview your page on different devices and screen sizes to ensure the text scales properly with the image. Adjust the `vw` unit as necessary to optimize readability across devices.
- Min and Max Font Size**: Sometimes using `vw` alone can make the text too small on very narrow screens or too large on very wide screens. To handle this, you can use CSS clamps or media queries to set minimum and maximum font sizes:
font-size: clamp(12px, 3vw, 24px);
This example sets the minimum font size to 12 pixels, the preferred size to 3% of the viewport width, and the maximum size to 24 pixels.
Best,
Jan
- Pavel-ww
- Joomla! Ace
- Posts: 1677
- Joined: Tue Jun 30, 2020 12:17 pm
Re: Text over image in JCE
Hi @williama.williama wrote: ↑Mon Apr 22, 2024 7:32 pmThe only trouble is that these images get displayed in a category blog-styled view, the images get resized and placed at different points, so this would not work for this. Is there a way to do the same thing, but resize dynamically based on the picture size, rather than the window size?
Yes, there is such a way. Using @container instead of @media and/or min(), max(), clamp() functions for font size.
https://developer.mozilla.org/en-US/doc ... er_queries
https://youtu.be/U9VF-4euyRo?si=08NTedsVRIizuuKO
https://youtu.be/3_-Je5XpbqY?si=3lFol6h69NjWgoQX
Looks like an answer from AI, and by the way, rather outdated approaches . Using AI also requires knowledge to choose relevant answersTo ensure that the text resizes dynamically with the image as the window size changes, you will need to use responsive CSS. This involves setting the font size using viewport units, which scale based on the size of the viewport (the visible area of the web page)....
Example of using AI
You do not have the required permissions to view the files attached to this post.
-
- Joomla! Enthusiast
- Posts: 130
- Joined: Sun May 18, 2008 10:01 pm
Re: Text over image in JCE
Hi Pavel, sorry for the late reply, and thanks for the help. I see what you mean AI-wise.
To be honest, this is getting a little beyond my expertise now. I did try what you suggested, but I couldn't figure it out. Instead, I decided to just add the text to the image in photoshop. Not the most elegant way to do things, but it does work.
To be honest, this is getting a little beyond my expertise now. I did try what you suggested, but I couldn't figure it out. Instead, I decided to just add the text to the image in photoshop. Not the most elegant way to do things, but it does work.
Pavel-ww wrote: ↑Tue Apr 23, 2024 7:39 amHi @williama.williama wrote: ↑Mon Apr 22, 2024 7:32 pmThe only trouble is that these images get displayed in a category blog-styled view, the images get resized and placed at different points, so this would not work for this. Is there a way to do the same thing, but resize dynamically based on the picture size, rather than the window size?
Yes, there is such a way. Using @container instead of @media and/or min(), max(), clamp() functions for font size.
https://developer.mozilla.org/en-US/doc ... er_queries
https://youtu.be/U9VF-4euyRo?si=08NTedsVRIizuuKO
https://youtu.be/3_-Je5XpbqY?si=3lFol6h69NjWgoQX
Looks like an answer from AI, and by the way, rather outdated approaches . Using AI also requires knowledge to choose relevant answersTo ensure that the text resizes dynamically with the image as the window size changes, you will need to use responsive CSS. This involves setting the font size using viewport units, which scale based on the size of the viewport (the visible area of the web page)....
Example of using AI
1.jpg
-
- Joomla! Champion
- Posts: 6046
- Joined: Tue Aug 23, 2005 1:56 pm
- Location: South coast, UK
- Contact:
Re: Text over image in JCE
Personally I think this is the best solution.I decided to just add the text to the image in photoshop.
https://gadsolutions.biz Electrical services
https://electrical-testing-safety.co.uk Testing services
https://electrical-testing-safety.co.uk Testing services