限制在屏幕上显示30个字符,然后按css

时间:2017-11-28 11:22:45

标签: html5 css3

它是我们在应用程序左侧面板中应用的过滤器,如果字符串长度超过31个字符,我们希望将其限制为31个字符,包括空格,仅使用HTML / CSS。

CSS代码:

div.filter-search
div.collapse 
div.search-optionfilter 
ul.chosen-choices 
.badge{
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
     max-width: 31ch;
}

1 个答案:

答案 0 :(得分:2)

你错过了 public static URL buildImageURL(String query){ final String Image_Base_URL="image.tmdb.org"; final String File_Size="w185"; Uri.Builder builtUri = new Uri.Builder(); builtUri.scheme("https") .authority(Image_Base_URL) .appendPath("t") .appendPath("p") .appendPath(File_Size).appendPath(query).build(); URL url = null; try{ url = new URL(builtUri.toString()); }catch (MalformedURLException e){ e.printStackTrace(); } return url; } 财产

且缺少display:inline-block课程

div.filter-search
div.collapse div.search-optionfilter ul.chosen-choices li.search-choice div.badge { white-space: nowrap; 
overflow: hidden;
text-overflow: ellipsis;
max-width: 31ch; 
display: inline-block;
width: 31ch; 
background-color: #eeeeee;
border-radius: 5px;
padding: 4px 20px 4px 10px; 
color: #151b1e; 
font-size: 12px;
font-family: arial; 
margin-right: 6px; 
} 
.badge {
  min-width: 10px; 
  line-height: 1; 
  vertical-align: baseline; 
}