Comments on: content https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Fri, 23 Apr 2021 16:38:01 +0000 hourly 1 https://wordpress.org/?v=6.4.3 By: Chris https://css-tricks.com/almanac/properties/c/content/#comment-1690066 Thu, 11 Apr 2019 12:44:01 +0000 http://css-tricks.com/?page_id=14031#comment-1690066 You could scale the image with transforms… sorry late to the party…

]]>
By: Caleb https://css-tricks.com/almanac/properties/c/content/#comment-1661087 Thu, 31 Jan 2019 20:36:37 +0000 http://css-tricks.com/?page_id=14031#comment-1661087 You can scale an image with transform.

div::before {
  content: url(image.jpg);
  transform: scale(0.5);
}
]]>
By: Swikar https://css-tricks.com/almanac/properties/c/content/#comment-1626414 Wed, 25 Apr 2018 15:15:17 +0000 http://css-tricks.com/?page_id=14031#comment-1626414 Hey! I am not able to change the width and height of the image by using :before. Could you please help me?

]]>
By: Casual Visitor https://css-tricks.com/almanac/properties/c/content/#comment-1612095 Thu, 28 Sep 2017 15:36:36 +0000 http://css-tricks.com/?page_id=14031#comment-1612095 In reply to Zhong Tang.

content: “line 1 \a line 2 \a line 3”; should do the trick

\a is the “content “newline sequence.

]]>
By: Casual Visitor https://css-tricks.com/almanac/properties/c/content/#comment-1612094 Thu, 28 Sep 2017 15:33:18 +0000 http://css-tricks.com/?page_id=14031#comment-1612094 content: “line 1 \a line 2\a line 3”

\a is the “content” newline code

]]>
By: Zhong Tang https://css-tricks.com/almanac/properties/c/content/#comment-1610049 Thu, 06 Jul 2017 21:02:56 +0000 http://css-tricks.com/?page_id=14031#comment-1610049 Cool thing!

I just want to know how we can make the text in content property to be displayed as two or more line, for example:

.before { content: “line 1 line 2 line 3”};

then it will displayed as:

line 1
line 2
line 3

Thanks

]]>
By: Palash Singh Kachhawa https://css-tricks.com/almanac/properties/c/content/#comment-1608015 Fri, 14 Apr 2017 09:26:35 +0000 http://css-tricks.com/?page_id=14031#comment-1608015 In reply to Jenna.

True ! I’m waiting for it too.

]]>
By: Brad Kemper https://css-tricks.com/almanac/properties/c/content/#comment-1602094 Wed, 08 Jun 2016 18:28:39 +0000 http://css-tricks.com/?page_id=14031#comment-1602094

Note that you cannot change the dimensions of the image
when inserted this way.

You can if you give it ‘display:block’ or ‘display:inline-block’ (or probably some other display values other than ‘inline’). Or if you float it, or absolute position it.

]]>
By: Vern Zehr https://css-tricks.com/almanac/properties/c/content/#comment-1595367 Tue, 23 Jun 2015 23:04:40 +0000 http://css-tricks.com/?page_id=14031#comment-1595367 Did not see this mentioned in the comments….

Raster images (png, jpg, gif) won’t scale in the content of :before|:after but, an svg DOES scale based on the box size.

Of course the SVG has to be responsive.

]]>
By: timbernasley https://css-tricks.com/almanac/properties/c/content/#comment-1594155 Wed, 29 Apr 2015 14:12:56 +0000 http://css-tricks.com/?page_id=14031#comment-1594155 In reply to Ignacio.

Just add a span around your input element and give it the asterisk class instead of the input. Since ::before + ::after add the content before/after the elements own content and input elements don’t have content, your example doesn’t work.

]]>
By: Ignacio https://css-tricks.com/almanac/properties/c/content/#comment-1594140 Tue, 28 Apr 2015 18:39:28 +0000 http://css-tricks.com/?page_id=14031#comment-1594140 See the CodePen below: http://codepen.io/IgnaciodeNuevo/pen/PqwVQe

I want to add an asterisk, as in the image on the left to the input on the right.

I am completely stuck and it’s stupid that I don’t see.

]]>
By: Zuns https://css-tricks.com/almanac/properties/c/content/#comment-1594044 Thu, 23 Apr 2015 09:50:18 +0000 http://css-tricks.com/?page_id=14031#comment-1594044 “content: url(image.jpg);” Doesn’t work nicely on firefox.

]]>
By: Easy Home Noida https://css-tricks.com/almanac/properties/c/content/#comment-1587438 Thu, 11 Dec 2014 06:24:11 +0000 http://css-tricks.com/?page_id=14031#comment-1587438 I just want to mention that I certainly enjoyed you’re page. Likely I’m planning to bookmark your site . You really come with amazing articles. With thanks for sharing with us your blog site.

]]>
By: Max https://css-tricks.com/almanac/properties/c/content/#comment-1587104 Fri, 28 Nov 2014 06:32:28 +0000 http://css-tricks.com/?page_id=14031#comment-1587104 Can we combine content: url(image.jpg); width content: attr(data-image); ?
Something like this url(attr(data-image));

]]>
By: Anders Grimsrud https://css-tricks.com/almanac/properties/c/content/#comment-1583473 Sun, 06 Jul 2014 21:26:21 +0000 http://css-tricks.com/?page_id=14031#comment-1583473 In reply to Luke Gedeon.

Have you tried background-size: cover, as seen in this article?

]]>