Stop text from breaking lines - html

Hi I have a problem with my site. For some reason my text is breaking lines.
For example I have the word Hip Hop but it's showing up as
Hip
Hop
here is the html
<div class="medium-2 column first-post-category">
<h1 class="category-first"><?php $cat = get_the_category(); $cat = $cat[0]; echo ''; echo $cat->cat_name; echo ''; ?></h1>
</div>
and here is the css
.first-post-category{
position:absolute;
top:6%;
left:1%;
}
.category-first{
background:#0076c1;
font-family:'Khula', sans-serif;
font-size:30px;
color:#fff;
padding:6px;
}
here a photo example.
Photo One

with your current code it renders fine, but whenever you don't want break text into another line use white-space: nowrap
nowrap
Collapses whitespace as for normal, but suppresses line breaks (text wrapping) within text.
.first-post-category {
position: absolute;
top: 6%;
left: 1%;
}
.category-first {
background: #0076c1;
font-family: 'Khula', sans-serif;
font-size: 30px;
color: #fff;
padding: 6px;
white-space: nowrap
}
<div class="medium-2 column first-post-category">
<h1 class="category-first">Hip Hop</h1>
</div>

Related

Remove the empty space present below the image

we can see lot of empty space in link as below the image. I want to hide those empty space.
.main {
margin: 0 auto;
width: 1000px;
}
body, button, input, select, table, textarea {
font-family: 'Roboto Condensed', sans-serif;
color: #636363;
font-size: 14px;
line-height: 1.5;
}
html
<div class="custom_case">
<div class="custom_case_left">
<h1 class="cc1">Custom Cases</h1>
<h2 class="cc2">Make Your Own design</h2>
</div>
<?php
$brandSelect = '<select id="brand_select">';
$brandSelect .= '<option value="">My Brand</option>';
$brandSelect .= '</select>';
echo '<select id="model_select"><option value="">My Model</option></select>';
?>
<div class ="cc3">
<div class ="cc4">
<span class ="cc5"> See Cases > </span>
</div>
</div>
I dont want to give so much empty space between image and below footer
please help me for this.
Thanks in advance.
Figured it out for you!
Your image of the phone cases is what is causing the space issue.
.custom_case_right img {
/*float:right;*/
/*bottom:320px;*/
}
That will fix the spacing beneath your image. Now your image is displaying improperly and to fix do this
.custom_case_right {
float:right;
margin-top:-310px;
}
These two changes ought to take care of it for you. I tested this out in Chrome.
You'll still need to think about how you want to have your image behave as your viewport shrinks though.
trying to make img:
line-height: 0;
vertical-align: top or bottom;
You have to fix the height of main-container.
enter code here.main-container{
height:550px;
}
Make this changes to your classes:
.col1-layout .col-main {
position: relative;
}
.custom_case_right {
float: left;
position: absolute;
top: 0;
bottom: 0;
right: 0;
}
And in your image remove position absolute, add this style instead:
.custom_case_right img {
position: relative;
width: 620px;
height: 100%;
}

How to put an <p> element directly after an <a> element without placing it on a new line

When I was working on my site I walked towards a problem. I want to have the <.p> element directly after my <.a> element, so it is not a line under it.
How it is now:
Login
\
Register
How I want it:
Login \
Register
You can visit my site if you want to take a look:
v14rkoende.helenparkhurst.net
This is my html code:
<div class=logreg>
<div class=logregb>
<p class=loginl ><a href=login.html class=loginr>Login</a> /</p>
<p class=loginl ><a href=register.html class=loginr>Registreer</a></p>
</div>
</div>
This is my CSS code:
.loginr {
font-family: Century Gothic;
color: white;
font-size: 12px;
margin-bottom: 0px;
margin-top: 0px;
text-decoration: underline;
}
.loginl {
font-family: Century Gothic;
color: white;
font-size: 12px;
text-decoration: none;
margin: 0px;
}
.logreg {
margin-left:-20px;
}
.logregb {
width: 0px;
margin-left: auto ;
margin-right: auto ;
margin-top: -40px;
}
Thanks for helping me out
Solution was to make the width bigger so for example:
.logregb {
width: 100px;
margin-left: auto ;
margin-right: auto ;
margin-top: -40px;
}
Thanks to all people for the fast awnsers!
try this (UNTESTED):
.loginl a {
float:left;
}
The width of your parent DOM element is to small. Remove the .logregb {width: 0px;} because it results in 2 line breaks.
Alternatively
Add nowrap to your CSS as following:
.loginl {
[...]
white-space: nowrap;
}
Here is the JSFiddle: http://jsfiddle.net/j3t47pqg/1/
p a {
display:inline-block;
}
<div class=logreg>
<div class=logregb>
<p class=loginl >
<a href=login.html class=loginr>Login</a>
<a href=register.html class=loginr>Registreer</a>
</p>
</div>
</div>

Trouble with my css

I'm using wordpress and woocommerce and I'm having difficulty with the css on single product pages :
The red border should surround all the content like here : http://lebruloir.com/cafe-bistrot/
But when on single product page it is all messed up : http://lebruloir.com/boutique/test/
I'm pretty sure it is a really simple solution but I can't seem to find it.
the code of woocommerce.php (which is used to display content) PS : it is normal that there is a alone it is closing a div called from the header
Thank you so much
<?php get_header(); ?>
<div class="col span_5_of_8 transparent">
<div class="site-content">
<?php if ( function_exists('yoast_breadcrumb') ) {
yoast_breadcrumb('<p id="breadcrumbs">','</p>');
} ?>
<div class="border"></div>
<?php woocommerce_content(); ?>
</div>
</div>
This is caused by the floating content inside the <div> with the border.
Try adding overflow: auto to .site-content.
.site-content {
font-family: 'Radley', 'Libre Baskerville', 'Fenix', serif;
color: #6B0001;
font-size: 110%;
z-index: 1;
word-wrap: break-word;
padding: 4% 4% 0;
border: solid 1px #6B0001;
margin: 15px 15px 15px;
overflow: auto; /* ADD THIS */
}

Text-overflow on a div containing php echo?

I'm stuck on how to use the 'text-overflow' function.
Heres my code:
<style type="text/css">
#filenm { white-space: nowrap; width: 100%; overflow: hidden; text-overflow: ellipsis; } </style>
<td width="614" height="28" colspan="18" background="images/site_23.gif"><div id="filenm" style="display:block; font-family:Arial, Helvetica, sans-serif; color:#FFF; text-align:center;"> <?php $filename = $_GET['filename']; echo 'File Name:'.$filename.'.zip'; ?></div></td>
Id like the text in the div 'filenm' to not over-flow out of the box that it is in.
Huge thanks to anyone who can help!
You need to set a height for overflow for it to work:
#filenm{
height: 300px;
}
With this example you hide the text if its not fit in the div and replace the text that not fit in to dots. You can see a working version on http://jsfiddle.net/McXav/8/
HTML
<div> This text is way to long for this div</div>
CSS
div {
text-overflow:ellipsis;
overflow:hidden;
white-space:nowrap;
width: 100px;
padding: 10px;
}
Output
This text is w...

The font is not being displayed at the bottom of the container?

This is my HTML code to display font with a background in a small container . .
here is the css
.cons_save h4{font:bold 22px/60px Arial,Helvetica, sans-serif;margin:20px 0px -15px 20px; color:#f78d1d;vertical-align: bottom; background:url(../images/save_bg_cons.png) no-repeat; width:151px; height:69px;}
im not able to put it ! in the bottom of that container whatever the other content above it in the container remains
My HTML CODE
<div id ="<?php echo $store->branch_id;?>Collect" style="display:block">
<span class="cons_save fl clr">
<h4><?php echo $save. " %"; ?> </h4>
</span>
</div>
First, I would write each property of the CSS separately as follows:
.cons_save h4 {
font-weight: bold;
font-size: 22px/60px;
font-family: Arial, Helvetica, sans-serif;
margin: 20px 0px -15px 20px;
color: #f78d1d;
vertical-align: bottom;
background: url(../images/save_bg_cons.png) no-repeat;
width: 151px;
height: 69px;
}
then, it seems that the class name does not match the one in the span tag.
You should actually try and set the class name in the header tag itself.
Don't put heading tags insides spans
<div id ="<?php echo $store->branch_id;?>Collect" style="display:block">
<div class="cons_save fl clr">
<h4><?php echo $save. " %"; ?> </h4>
</div>
</div>
And also heading having a lot of margin & padding by default. So might be the reason to come in the bottom. Be sure to clear it
.cons_save h4 { margin: 0;padding:0; }
It works without the reset too, check here
not sure what is the problem, if you could sepcify using http://jsfiddle.net/ then it would be nice.
anyway, i suggest you changing span to div, like this:
<div id ="<?php echo $store->branch_id;?>Collect" style="display:block">
<div class="cons_save fl clr">
<h4><?php echo $save. " %"; ?> </h4>
</div>
</div>
moreover, you have vertical-align which would not work, unless you add to your css display: table-cell [note: this will not work in IE7]:
.cons_save h4{display: table-cell;font:bold 22px/60px Arial,Helvetica, sans-serif;margin:20px 0px -15px 20px; color:#f78d1d;vertical-align: bottom; background:url(../images/save_bg_cons.png) no-repeat; width:151px; height:69px;}
I wouldn't recommend you to use that property (vertical-align) on block level elements. And don't put a heading inside a span.
Without changing the HTML I would do this:
#Collect{
border: 1px solid #ccc;
width: 151px;
height: 69px;
}
h4{
font-weight: bold;
font-size: 22px/60px;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
color: #f78d1d;
background: url(../images/save_bg_cons.png) no-repeat;
background:#eee;
position: absolute;
bottom: 0;
}​
You can even get rid of the span.