Linked Questions

158 votes
14 answers
448k views

I'm experiencing some trouble with the width property of CSS. I have some paragraphs inside a div. I'd like to make the width of the paragraphs equal to their content, so that their green background ...
user3067088's user avatar
  • 1,987
11 votes
4 answers
30k views

If I have HTML that looks like this: <div class="figure"> <img src="some_image.png" /> <div><span class="caption">Fig. 1: Some caption</span></div> </div>...
Jason S's user avatar
  • 190k
14 votes
1 answer
42k views

I want to create a simple div that shrinks and expands according to the content contained. https://jsfiddle.net/qa5dr0x8/ <body> <div style="border: 1px solid red; padding: 15px; width:...
membersound's user avatar
  • 87.8k
16 votes
3 answers
5k views

Possible Duplicate: Make CSS Div Width Equal To Contents I am trying to make a chat like application but now I ran acros a little bug of some sort. I have a div with a max-width set to 350px. But ...
Dirk-Jan's user avatar
  • 1,149
5 votes
5 answers
1k views

My idea is to make each element within divs that have the .main_content class, to have a width equal to the width of the text inside it. How do I this? As you can see, the width of each one (span, h2,...
Laura's user avatar
  • 759
2 votes
5 answers
3k views

.main-heading { display: block; font-family: "Josefin-Sans", sans-serif; font-size: 70.6px; font-weight: bold; text-align: center; color: #ba9a45; } .subheading { font-family: "Cardo", ...
derrickogole's user avatar
0 votes
4 answers
6k views

I am new to Html & CSS. I want a heading which contains text like "Women safty". I want to warp the heading text with border. But when I apply border to text the border covers all the ...
NaVeEd IbRaHiM's user avatar
0 votes
7 answers
9k views

In the following snippet, the border outlines the block and not just around the text inside it: .border { font-size: 30px; text-align: center; border: red 2px solid; } <p class="border"&...
Ronpic's user avatar
  • 19
0 votes
2 answers
3k views

I have an <h1> with a text-decoration of underline, I was able to make it the same width as text via display: table-cell like so: #login h1 { color: #FFF; border-bottom: 2px solid #...
user979331's user avatar
  • 12.1k
0 votes
1 answer
2k views

I have an element that takes 100% of its container's width: How do I make it so the width of the element is as wide as the text? I can't find the answer online because I don't know how to formulate ...
JOKKER's user avatar
  • 542
7 votes
1 answer
2k views

I have attached a fiddle link to this question. I need the red dot to be closer to the text. For the first & last item, it works well..but if any item is multi line..it has extra whitespace at the ...
Treesa's user avatar
  • 393
0 votes
4 answers
931 views

I have a div block inside which I have a paragraph whose background is black: <!DOCTYPE html> <html> <head> <style> div { background-...
pr0grammar's user avatar
1 vote
2 answers
839 views

I have a container that effectively, I want to compress the contents to their minimum width without scroll bars. fit-content is close, but allows the content to use more width than it actually needs. ...
Tezra's user avatar
  • 8,873
-1 votes
3 answers
2k views

I NEED to use display: flex in order to style this icon and text that are within a span tag. As you can see the width is way too long, I just want the width to be just as long as the width of image ...
Devmix's user avatar
  • 1,908
0 votes
3 answers
1k views

I have a div inside which I have content. I gave width = auto and then gave max-width but the container is taking up a constant fixed no matter what the size of the content is: .adjustablebox { ...
Newbie_developer's user avatar

15 30 50 per page
1
2 3 4 5
8