Thank you all for your time.
I am trying to do something simple but it turns out to be so complicated.
I need a link to send an email but there's some issue with the style. It shows the content fractured (see jsfiddle). But when I right click several times, everything is back to normal. Any idea?
.sendAll {
float: right;
margin-right: 10%;
margin-bottom: 3%;
margin-top: 2%;
display: inline-block;
}
#sendAll {
color: white;
padding: 7% 25%;
background-color: #0080FF;
display: inline-block;
}
#sendAll:hover {
background-color: #0164c6;
}
HTML:
<div class="sendAll">
<a href="#">
<b id="sendAll">Send Email to All Selected</b>
</a>
</div>
Here's the jsfiddle link
Thank you all !
Just provide display: block to #sendAll
The <b> tag provides a font-weight: bold property to the element, but the element is not a block level element by itself. So, you have to manually specify the same.
Refer code:
.sendAll {
float: right;
margin-right: 10%;
margin-bottom: 3%;
margin-top: 2%;
display: inline-block;
}
#sendAll {
color: white;
padding: 7% 25%;
background-color: #0080FF;
display: block;
}
#sendAll:hover {
background-color: #0164c6;
}
<div class="sendAll">
<a href="#">
<b id="sendAll">Send Email to All Selected</b>
</a>
</div>
Try this:
.sendAll {
float: right;
margin-right: 10%;
margin-bottom: 3%;
margin-top: 2%;
display: inline-block;
}
#sendAll {
color: white;
padding: 7% 25%;
background-color: #0080FF;
display: inline-block;
white-space:nowrap;
}
#sendAll:hover {
background-color: #0164c6;
}
Explain
Add a property white-space:nowrap in #sendAll id
update code link
if you want your text on only one line, add the following to your #sendAll class
white-space: nowrap;
Related
I have a basic website and I'm stylizing html with css. I put two paragraphs next to each other and they appear on the same line, although separately as two centered pieces.
For example:
<p>ugh</p>
<p>yay</p>
would show up in the website like
ugh yay
instead of
ugh
yay
The CSS I have for the paragraphs are:
p {
text-align: center;
color: black;
display: block;
font-size: 20px;
margin-top: 0;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
}
NOTE TO EVERYONE: REMOVING INLINE-BLOCK DID NOT FIX IT
FULL CODE CSS: https://jsfiddle.net/sprot9uh/
p {
background: yellowgreen;
text-align: center;
color: black;
display: block;
font-size: 20px;
margin-top: 0;
margin-bottom: 10px;
margin-left: auto;
margin-right: auto;
}
.inline {
display: inline-block;
margin-right: 20px;
background: yellow;
}
<p class="inline">I'm an inline block element....
</p>
<p class="inline"> me too
</p>
<p> But I'm a block level element
</p>
<p>Me too
</p>
remove inline-block for p
p {
text-align: center;
color: black;
font-size: 20px;
margin-top: 0;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
}
That's what the inline-block does in your css. You can either completely remove it or just use block.
add display:block in (p) tag instead of display:inline-block; and u can remove display-inline-block it's also worked...
<p> elements are display: block; by default. Usually all you need is:
p {
margin-bottom: 10px;
font-size: 20px;
color: black;
}
The default display property of p tag is 'block' so you can remove the display property.
You can refer the jsfiddle link
p {
text-align: center;
font-size: 20px;
margin-top: 0;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
}
Looking into your css code I think you have paragraphs <P></P> in <section></section> something like:
<section>
<p>123</p>
<p>456</p>
</section>
You have to change css for section (flex-direction from row to column):
section {
background: white;
color: gray;
padding: 20px;
display: flex;
flex-direction: column;
}
I'm trying to put divs side by side, but it's not working. One is inline, and the next one is down a little bit and a little bit to the right.
My code:
.FifteenInfo {
display: inline;
margin-top: 50px;
height: auto;
padding-right: 75px;
float: left;
}
.FourtyInfo {
display: inline;
margin-top: 50px;
height: auto;
padding-right: 75px;
}
.SixtyInfo {
display: inline;
margin-top: 50px;
height: auto;
padding-right: 75px;
}
.Package {
padding-left:70px;
margin-top: 15px;
}
.monthlyPrice {
padding-left:55px;
font-size:52px;
font-weight: bold;
color: #277FD8;
}
.differentbandwidth {
margin-left: 30px;
display: inline;
text-align: center;
padding: 15px;
border-style: solid;
border-color: #277FD8;
border-width: 3px;
border-radius: 8px;
}
.border {
border-left: thick solid #277FD8;
display: inline;
float: right;
}
.FifteenSpecs {
display: inline;
float: right;
}
<div class="FifteenInfo">
<h1 class="Package">Cable 15</h1>
<h3 class="monthlyPrice">\$39.99</h3>
<h3 class="differentbandwidth">\$69.99 Unlimited</h3>
<div class="FifteenSpecs border">
<h1>Cable 156666666666666666666666</h1>
<h3>\$39.99</h3>
<h3>\$69.99 Unlimited</h3>
</div>
</div>
Here's my image of the issue:
I'm completely lost, I've tried inline, and inline-block display times and they don't work.
So then I watched a couple of YouTube videos to brush up on display properties but it didn't work.
You mentioned in your comment that you wanted to make .FifteenSpecs.border display next to (inline with) .FifteenInfo.
The main problem then is simply that you have your .FifteenSpecs div inside your .FifteenInfo one, and hence it is displaying inside .FifteenInfo. Simply move it outside, like so:
body, html {
min-width: 1000px;
}
.FifteenInfo {
display: inline-block;
height: auto;
background-color: green;
vertical-align: top;
}
.monthlyPrice {
font-size:52px;
font-weight: bold;
color: #277FD8;
}
.differentbandwidth {
text-align: center;
border-style: solid;
border-color: #277FD8;
border-width: 3px;
border-radius: 8px;
}
.FifteenSpecs {
display: inline-block;
background-color: red;
vertical-align: top;
}
<div class="FifteenInfo">
<h1 class="Package">Cable 15</h1>
<h3 class="monthlyPrice">\$39.99</h3>
<h3 class="differentbandwidth">\$69.99 Unlimited</h3>
</div>
<div class="FifteenSpecs border">
<h1>Cable 156666666666666666666666</h1>
<h3>\$39.99</h3>
<h3>\$69.99 Unlimited</h3>
</div>
Some other things I changed in your code:
Changed inline to inline-block so that it retains the box model
Removed all the padding, margin: this really cluttered it up
Removed floats: inline-block will already make it "float" left.
Added vertical-align: top to make the top of the divs line up (as opposed to the bottom)
I have a simple inner/outer div problem where it's probably easier to explain through pictures. Here is my issue:
The comment "This is a witty comment." is not breaking down underneath the other 2 labels. Here is my HTML:
<div class="commentOuter">
<div class="commentAuthor">someauthor</div>
<div class="commentDate">17 minutes ago</div>
<div class="commentText"><span>This is a witty comment.</span></div>
</div>
And here's the CSS:
.commentOuter
{
border-radius: 4px;
width: 100%;
height: 20px;
float: left;
background-color: black;
margin-top: 10px;
padding: 5px;
}
.commentAuthor
{
float: left;
font-size: smaller;
color: #68a5d9;
display: block;
height: 15px;
}
.commentDate
{
float: left;
font-size: smaller;
margin-left: 5px;
color: #AAA;
display: block;
height: 15px;
}
.commentText
{
display: block;
width: 100%;
}
I don't understand that when I highlight the element in the dev tools, the div is not showing to be underneath the labels, as seen in this pic:
Any help is much appreciated.
Because you floated the previous 2 elements. If you need to move it below. Use a clear:
.commentText
{
clear:both;
display: block;
width: 100%;
}
You also have to remove the specified height for the .outerComment element.
Just because it's not floated, doesn't mean it won't be next to other elements.
See more here: https://css-tricks.com/all-about-floats/
I am currently working on a website and was wondering if You could help me solve a problem. I want the h1 title to be on the same line as the date but I can't get it to work for some reason.
The CSS code:
#content h1 {
font-family: 'Caveat', cursive;
color: #262626;
margin-top: 50px;
margin-left: 100px;
padding-bottom: 10px;
width: 50%;
border-bottom: 1px solid #ddd;
float: left;
}
.date {
float: right;
}
The HTML code:
<body>
<nav>
<a href='#' class='active'>Home</a>
<a href='#'>Partners</a>
<a href='#'>Contact</a>
<a href='#' class='about'>About</a>
</nav>
<div id='content'>
<h1>Welcome.</h1>
<p class='date'>01/01/2016</p>
</div>
</body>
Help is appreciated. :)
just add margin: 0 to h1 and p
#content h1 {
font-family: 'Caveat', cursive;
color: #262626;
margin-top: 50px;
margin-left: 100px;
padding-bottom: 10px;
width: 50%;
border-bottom: 1px solid #ddd;
float: left;
margin: 0;
}
.date {
float: right;
margin: 0;
}
jsFiddle
I checked your code on following problem I got
You added one css propertie for h1 tag i.e margin-top: 50px;
as per you applied float , but you not applied margin-top: 50px; for .date class
just add code
.date {
margin-top: 50px;
float: right;
}
What you are looking for is floats:
Jsfiddle
.alignleft {
float: left;
}
.alignright {
float: right;
}
The reason why they aren't completely right on each other, is that your welcome is a h1 and it has got some bigger styling than the p does. Could be solved with some custom styling.
You can read more about left and right aligning here
Hope this is what you were looking for.
Cheers :)
I want to display the text and image in same line but image display slight above from text.Demo
html img.del {
display: inline-block;
float: right;
cursor: pointer;
margin-right: 74%
}
.astext {
text-align: left;
margin-left: 10%;
}
<h4><span><a class="astext" href="'.$next.'" title="'.$next.'" target="_blank" download><p style="margin-left:1cm;">'.$next1.'</a></span>
<img src="image/delete1.png" class="del" alt="delete" style="width:10px;height:10px" title="Remove" onclick="myFunction('.$fet['f_id'].');"></h4>
first of all, you got some open tags in your code:
second: i updated your fiddle to work correctly:
img.del {
display: inline-block;
cursor: pointer;
margin-right: 74%;
position: relative;
}
.astext {
display: inline-block;
text-align: left;
margin-left: 10%;
}
this is how it should be displayed right?
float: right and display: inline-block do not work together since they sort of the same thing.
see this reference: http://www.ternstyle.us/blog/float-vs-inline-block
and here is your fiddle:
http://jsfiddle.net/1z9b9m9p/4/