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"/ >
Related
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 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 7 years ago.
Improve this question
I want to remove white space which is colored black on image from both side
to remove this white space from header i add margin-left:-10px
.site-header-main {
float: left;
width: 100%;
margin-left: -10px;
padding: 44px 0 22px;
padding: 4.4rem 0 2.2rem;
background-color: #fff;
}
After adding this I successfully removed white space from the left side but a grey color space comes on right side image here
Please remove the margin: -10; you put in the css and add this to it.
.site-header-main .container {
padding: 0px;
}
The container class is having a margin of 3.3em from both left and right. so this will fix this glitch.
if You want to remove this from the whole site try this
body .container {
padding: 0px;
}
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 7 years ago.
Improve this question
I have an <a> tag embedded in an <h2> tag as shown in http://codepen.io/anon/pen/gpjZaJ. The problem I'm having is that the text of the hyperlink (styled as a button with Bootstrap) is lower than the <h2> text, ie: they're not vertically aligned. I've found that I can better align them by setting the padding of the hyperlink to 0px but that doesn't very good and seems a little hacky. I'm wondering if there's a better way to vertically center the hyperlink.
In the example padding-top was set to 0 and the text did align. I assume you want to keep the padding and still have the text aligned?
Simply set vertical-align: initial on the button (it's set to middle) and it looks good in Chrome: http://codepen.io/anon/pen/WvKLRw
.jumbotron h2 a {
font-size: inherit;
vertical-align: initial;
}
If your question is vertically center the hyperlink,try to add
padding-bottom: 0px; in class .jumbotron h2 a
like this
.jumbotron h2 a {
font-size: inherit;
padding-top: 0px;
padding-bottom: 0px;
}
You'll need to make the link inline-block then vertically align it baseline
.jumbotron {
text-align: center;
}
.jumbotron h2 a {
font-size: inherit;
display: inline-block;
vertical-align: baseline;
}
span {
margin-left: -100px;
}
.jumbotron h2 {
font-size: 48px;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="jumbotron" id="jumbotron">
<div class="container">
<h2><a class="btn btn-info" href="#contact">Contact Us</a> <span>to get your free estimate today.</span></h2>
</div>
</div>
I added a span and moved it over so you can see the alignment.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I am looking at generating the below image using CSS.
I've tried adding all the required information needed below.
The BgColor, Font-Color, Font Size, Font Family, Font Style. Please mention if any other data is needed.
The Font Text should be displayed in the middle of the image. How do I build CSS to get the text in the centre.
HTML
<div>WW</div>
CSS
div{ background:#ced6e9;
font:bold 46px arial; color:#315bb4;
width:100px; height:100px; line-height:100px;text-align:center}
Here is the Demo http://jsfiddle.net/9Dxza/1/
horizontal centering:
text-align : center;
vertical centering:
line-height : 100px;
background-color: green;
height: 35px;
width: 35px;
text-align: center;
line-height: 35px;
font-size: 18px;
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;
}