Welcome visitor
* Login
* Register
It is currently July 15th, 2019, 8:04 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  CSS applied to a div to fit one line only
PostPosted: December 5th, 2009, 8:34 am 

Posts: 10
Try this code to see what my problem is:
<style type="text/css">
.h1{background-color: #00ff00; width: 30px;}
</style>
<div class="h1"><h1>this is a big text inside a small div</h1></div>

The text is bigger than the div, so the div stretches down and I want to avoid that. The div should be one line height only and the rest should be hidden, can I do it with HTML or should I use images instead?


Top
 Profile  
 
  Re: Apply CSS to a div to fit one line only
PostPosted: December 6th, 2009, 2:26 am 
User avatar

Posts: 63
You need to set also the height of the div and then tell it to hide anything that does not fit in there.
<style type="text/css">
  .h1
  {
    background-color: #00ff00;
    width: 50px;
    height: 4em;
    overflow: hidden
  }
</style>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron