Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a background img 120x30, but it's not showing in the full size..why?
Please look here http://f1u.org/en - under each article readmore button.
<a> is an inline element. So, an inline element in not take height, width , vertical margin & vertical padding in it's.
Then we have to define display:block in the css like this:
.comments-link, .readmore-link {
display: block;
}
Add display: block;
.comments-link, .readmore-link {
background: url("images/readmore.png") no-repeat scroll 0 0 transparent;
border: medium none;
display: block;
font-size: 11px;
height: 30px;
line-height: 30px;
padding: 0;
text-indent: 8px;
text-transform: uppercase;
width: 120px;
}
The a tags are inline elements so width won't apply, they will automatically resize depending on content. If you change the display to block then you can control the elements width and height and should see the image. You might want to also float them so if you have the comments link and read more link they will be displayed side by side. Add the following to your style sheet:
.comments-link, .readmore-link {
display: block;
float: left;
}
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
Improve this question
Problem:
Interested to know if there are any real-world examples in HTML/CSS when you need to use display: block on inline elements. For the reverse order, I found that display: inline could be used on <li> in a <nav> to display links vertically. I am not interested to know the difference between inline, block, and inline-block.
Current examples:
Current examples include showing how to use the display: block on <span> elements, and so forth. But many of these examples only illustrate the effect of display: block but not the actual use of it on a website.
Question:
For what reason and where on a website could it be relevant to use display: block to change elements from inline-level to block-level?
Let's say you wanted to show a big button that links to a site. You use an anchor (<a>) tag because it can contain a hyperlink.
div {
border: 1px solid black;
padding: 20px;
}
.button {
background: orange;
color: white;
padding: 10px;
text-align: center;
}
<div>
This button's on the same line! <a class="button" href="https://example.com">Click me!</a>
</div>
You add your button, but you've run into a problem: The button's on the same row as all the other text. It's inline!
Adding display: block not only adds a newline, it also gives you more control about the width and height of the button.
div {
border: 1px solid black;
padding: 20px;
}
.button {
display: block;
background: orange;
color: white;
padding: 10px;
text-align: center;
}
<div>
This button's aligned properly. <a class="button" href="https://example.com">Click me!</a>
</div>
If you wanted to control the button's width and height, while keeping it on the same line, you would use inline-block.
Further reading
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I want to bring my Sketch file to HTML/CSS in the browser.
How can I implement the white line just between the small and big text, as shown in the image below?
If don't want to include any additional html element then you can use pseduo element:after.
h2:after {
display:block;
content:" ";
width: 80px;
height: 5px;
background: grey;
margin-top: 5px;
}
fiddle
You can add an empty div with a bottom border & custom width, which is of cleaner and shorter code:
body {
background-color: blue;
color: white;
}
#mydiv {
border-bottom: 4px solid white;
width: 33%;
}
#myline {
height: 4px;
background-color: white;
border: 0px solid black;
width: 33%;
}
A div:
<div id="mydiv"></div>
A horizontal line:
<hr id="myline" />
That's 4 lines for the HR and 2 for the div, and that's without making the hr align to the left.
If you don't want to add another element you can use ::after on any element - just make it have display: block and set the color, width, height etc. similar to the above code.
You can add tag <hr> and him specify needed width, height,color...
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How can I apply various effects, like increasing its size etc., using CSS to this arrow
https://jsfiddle.net/tnfLc58h/
So far I've been able to change its color.
HTML
<div class="down-arrow">
</div>
CSS
.down-arrow:after {
content:'\2193';
color: red;
}
edit: I want to make it responsive.
Since a pseudo element is an inline element, you need for example to give it display: inline-block (or block) for it to respond to width/height settings (though not if only to change font properties of course, as some comments assumed I meant).
.down-arrow:after {
content:'\2193';
display: inline-block; /* or block */
background: lightgray;
color: red;
height: 32px;
width: 40px;
font-size: 24px;
text-align: center;
}
<div class="down-arrow">
</div>
To increase the size of the content, you should set the font-size
Like so :
.down-arrow:after {
content:'\2193';
color: red;
font-size: 20px; // change to whatever
}
See updated EXAMPLE
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
Help! I've read every question here and every tutorial online… but I can't seem to make the left and right column bottom border appear on my layout that I'm trying to put together.
Here is a link where I am currently working on it.
Can anyone tell me what I am doing wrong?
My current css is:
.main-inner .fauxcolumn-left-outer .fauxcolumn-inner {
margin-right: 20px;
background: white url(http://i1109.photobucket.com/albums/h423/thesinglemomoirs/templates/pinkcupcake/38d73024.png) repeat scroll top left;
border: 2px solid black;
}
.fauxcolumn-outer .fauxborder-left, .fauxcolumn-outer .fauxborder-right, .fauxcolumn-inner {
height: 100%;
}
The solution to your problem is to set the box-sizing like so:
.fauxcolumn-inner {
box-sizing: border-box;
}
Your problem is that without box-sizing to border-box when you set your height to 100%:
.fauxcolumn-outer .fauxborder-left,
.fauxcolumn-outer .fauxborder-right,
.fauxcolumn-inner {
height: 100%
}
and THEN add margins, padding or borders, your true height ends up being greater than 100%
You could replace border with an inner box shadow with no blur:
box-shadow: inset 0 0 0 2px #000000;
.yourclass {
border-bottom:thick solid black;
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this question
I have the following page:
Page on JSBin
If you look at the top-right-hand corner, then you can see that the settings & chat pic and the username is aligning with the lower border of the profile picture.
How could I make all elements in top-right-hand-corner align in the middle of the top-bar?
The top-bar is supposed to look like that:
EDIT: I have applied the vertical-align: middle property to these elements. However, as you can see at ranganadh's JSBin, the image seems to be a bit too near to the lower corner. Any suggestions on that?
add vertical-align:middle property to class .top-right-button
change to
.top-right-button{
margin-right: 5px;
vertical-align:middle
}
Check JSBin
You need to modify your CSS as follows:
.right-stuff {
position: absolute;
bottom: 2px;
height: 100%;
right: 0px;
font-family: Roboto Condensed, bold;
font-size: 24px;
}
.top-right-button {
margin-right: 5px;
vertical-align: middle;
}
The vertical-align property is not inherited and must be specified explicitly.
By default, your right most image is aligned with the default baseline of the container block. Setting vertical align to middle gives a more pleasing view.
If you need to, use the bottom offset to adjust the overall vertical position of the .right-stuff block.
See demo at http://jsbin.com/uSiTOpU/16/edit
I hope i understand your edit well.
Try to change
#top-right-profile-image {
margin-top: 5px;
width: 40px;
height: 40px;
background-color: #ffffff;
}
to
#top-right-profile-image {
width: 40px;
height: 40px;
background-color: #ffffff;
}
It gives a better looking result.
I believe you simply need to add an valign="top" to your profile image.
<img valign="top" class="top-right-button" id="top-right-profile-image" src="//www.placehold.it/20x20"/ >