Css hide text in padding

CSS hide part of text in html using css

The following tutorial shows you how to use CSS to do «CSS hide part of text in html using css».

CSS Style

The CSS style to do «CSS hide part of text in html using css» is

#field-dishe < position:relative; > #field-dishe:before < position:absolute; width:35px; top:0; bottom:0; z-index:2; background:white; content:" " >

HTML Body

body> something before div id="field-dishe" >"readonly_label"> 5000   . ? . Pork Trotters in Sweetened Vinegar Or Chicken Stewed in Rice Wine br> 5001   . Rendang Chicken br>   

The following iframe shows the result. You can view the full source code and open it in another tab.

!-- w w w .d e m o 2 s . c o m --> http://jsbin.com Released under the MIT license: http://jsbin.mit-license.org --> html> head> style> #field-dishe< position: relative; > #field-dishe:before < position: absolute; width: 35px; top:0; bottom:0; z-index:2; background: white; content:" " >  body> something before div id="field-dishe" >"readonly_label"> 5000   . ? . Pork Trotters in Sweetened Vinegar Or Chicken Stewed in Rice Winebr> 5001   . Rendang Chickenbr>    

  • CSS Hidden text over iFrame
  • CSS Hide all text except for the first letter with CSS
  • CSS Hide only text in html paragraph
  • CSS hide part of text in html using css
  • CSS Hide some text through CSS
  • CSS Hide specific text using just CSS
  • CSS Hide text by degrading like Google play does

demo2s.com | Email: | Demo Source and Support. All rights reserved.

Источник

Css hide text in padding

  • Difference between HTML and CSS
  • What are physical tags in HTML?
  • HTML | Deprecated Tags
  • Container and Empty Tags in HTML
  • HTML Comments
  • How to set background image in HTML ?
  • How to define a list item in HTML5?
  • Difference between semantic and non-semantic elements
  • How to Create Color Picker input box in HTML ?
  • HTML Hex Color Codes
  • HTML Block and Inline Elements
  • HTML Drag and Drop
  • How to set the name for the object in HTML5?
  • How to add space between elements ?
  • How to create a clickable button in HTML ?
  • HTML Links
  • How to link back out of a folder using the a-href tag?
  • HTML ping Attribute
  • HTML disabled attribute
  • What is the use of “#” symbol in link URL ?
  • How to create a link with a media attribute in HTML5 ?
  • How to specify the source URL of the quote using HTML5 ?
  • How to specify that the target will be downloaded when a user clicks on the hyperlink in HTML5 ?
  • How to specify the hyperlink target for the area of an image in HTML5 ?
  • How to make a HTML link that forces refresh ?
  • How to set the language of text in the linked document in HTML5 ?
  • How to specify what media/device the target URL is optimized for ?
  • How to specify URL of resource to be used by the object in HTML5 ?
  • How to use Anchor tag as submit button ?
  • Elements of a form Tag
  • How to set an alternate text for area in HTML5 ?
  • How to specify one or more forms the object belongs to ?
  • How to specify one or more forms the keygen element belongs to ?
  • How to turn on/off form autocompletion in HTML ?
  • How to specify that a group of related form elements should be disabled using HTML?
  • How to specify how form-data should be encoded when submitting to server ?
  • How to specify the URL that will process the data supplied through input(s) when the form is submitted?
  • How to specify one or more forms the label belongs to ?
  • How to specify multiple forms the select field belongs to in HTML ?
  • How to change the type?
  • How to specify which form element a label is bound to ?
  • How to create a multiline input control text area in HTML5 ?
  • How to create form validation by using only HTML ?
  • HTML Emojis
  • How to animate a straight line in linear motion using CSS ?
  • How to specify the media type of the script in HTML5 ?
  • How to display video controls in HTML5 ?
  • How to mute video using HTML5 ?
  • How to add controls to an audio in HTML5 ?
  • Create Scanning Animation Loader using HTML & CSS
  • How to specify media type of data specified in data attribute in HTML5 ?
  • How to set the height and width of the video player in HTML5 ?
  • How to check whether an image is loaded or not ?
  • How to specify the type of the media resource in HTML5 ?
  • How to Create Image Hovered Detail using HTML & CSS ?
  • How to define media type of style tag in HTML5 ?
  • How to set multiple media resources for elements in HTML5 ?
  • How to set a single line break in HTML5 ?
  • How to create a progress bar using HTML and CSS?
  • How to create Perspective Text using HTML & CSS ?
  • How to isolate a part of text that may be formatted in a different direction using HTML5 ?
  • Design an Event Webpage using HTML & CSS
  • How to Skew Text on Hover using HTML and CSS?
  • Programming a slideshow with HTML and CSS
  • How to specify that an option-group should be disabled in HTML5 ?
  • How to disable the drop-down list in HTML5 ?
  • How to define scalar measurement within a given range in HTML5 ?
  • How to set the security algorithm of key in HTML5 ?
  • How to set minimum and maximum value of range in HTML5 ?

Источник

Показать/скрыть текст. Примеры на JS, CSS

Показать/скрыть текст

Давайте рассмотрим разные примеры того, как можно показать/скрыть текст по нажатию на кнопку. Обычно такая функция называется спойлер или аккордеон. Это когда весь текст или половина его скрыта от просмотра, и только при нажатии на кнопку, или определённый элемент, открывается весь текст.

Разнообразие реализации такой фишки, как показать/скрыть текст может быть огромное количество. Есть разный подход к технической части: на чистой JavaScript, jQuery, чистый CSS, HTML. Для WordPress можно найти специальные плагины или сделать раскрывающийся текст без плагина.

Показать скрыть текст JS

Первые примеры будут с использованием JS/jQuery. Всё представленное ниже можно «прикрутить» к любому сайту на любой платформе. Внешний вид, то есть дизайн, легко редактируется с помощью CSS.

Первый пример Посмотреть демо

  

.spoiler_wrap < position: relative; margin-bottom: 20px; font-size: 22px; background: #fff; border-radius: 5px; height: fit-content; >.spoiler_title < cursor: pointer; >.spoiler_title, .spoiler_content < padding: 30px 26px; >.spoiler_content < padding-top: 0; padding-bottom: 10px; transition: 0.15s ease-out; height: auto; max-height: 0px; overflow: hidden; margin-top: -10px; opacity: 0; font-size: 14px; color: #444; >.spoiler_content p < font-size: 16px; margin: 20px 0; color: #333; line-height: 1.4; >.spoiler_content.open < margin-top: 0; max-height: 100%; opacity: 1; >.spoiler_title .spoiler_arrow < display: inline-block; margin-left: 15px; font-size: 20px; transition: all .1s; vertical-align: middle; >.spoiler_title .spoiler_arrow svg < fill: red; width: 13px; >.spoiler_title .spoiler_arrow.open

Второй пример Посмотреть демо

  

.morecontent span < display: none; >.morelink

Третий пример Посмотреть демо

  
.spoiler_wrap < border-bottom: 1px solid #999999; margin-bottom: 15px; >.spoiler_wrap.active .spoiler_content < max-height: 500px !important; padding-bottom: 25px; transition: max-height 0.5s ease, padding-bottom 0.3s ease; >.spoiler_wrap.active .spoiler_title < color: #808080; transition: color 0.3s ease; >.spoiler_content < color: #090909; font-family: serif; font-size: 16px; line-height: 24px; max-height: 0; overflow: hidden; transition: max-height 0.5s ease, padding-bottom 0.3s ease; >.spoiler_content p < margin-bottom: 25px; >.plus-minus-toggle < cursor: pointer; height: 21px; position: absolute; width: 21px; left: -40px; top: 50%; z-index: 2; >.plus-minus-toggle:before, .plus-minus-toggle:after < background: #000; content: ''; height: 4px; left: 0; position: absolute; top: 0; width: 21px; transition: transform 500ms ease; >.plus-minus-toggle:after < transform-origin: center; >.plus-minus-toggle.collapsed:after < transform: rotate(90deg); >.plus-minus-toggle.collapsed:before < transform: rotate(180deg); >.spoiler_title < color: #090909; font-family: sans-serif; font-size: 20px; font-weight: 800; text-transform: uppercase; position: relative; cursor: pointer; padding: 20px 0; transition: color 0.5s ease; >@media screen and (max-width: 767px) < .spoiler_title < font-size: 18px; >>

Четвертый пример Посмотреть демо

  

.spoiler_wrap < margin-bottom: 40px; >.spoiler_title_wrap < display: block; padding: 0px; >.spoiler_title < margin-bottom: 20px; font-size: 22px; font-weight: 600; color: #000; cursor: pointer; display: table; transition: all .3s ease-in-out; position: relative; >.spoiler_title:hover, .expanded .spoiler_title < opacity: 0.7; >.spoiler_content < font-size: 16px; border-radius: 5px; line-height: 26px; display: none; margin-bottom: 30px; padding: 30px; background: #333; position: relative; >.spoiler_content p < color: #999; margin-bottom: 25px; >.spoiler_content p:last-child < margin-bottom: 0px; >.arrow-t < transform: rotate(-45deg); display: block; position: absolute; top: 7px; right: -33px; width: 10px; height: 10px; background: transparent; border-left: 3px solid #000; border-bottom: 3px solid #000; transition: all .3s ease-in-out; >.arrow-b

Пятый пример Посмотреть демо

  

.text_hide_wrap < max-width: 700px; >.item_text < width: 100%; padding: 20px; >.item_text p < margin-bottom: 20px; >.io_item < width: 100%; padding-bottom: 20px; >.io_button_wrap < text-align: center; margin-top: 10px; >.io_button < display: inline-block; border: 1px solid #f00; width: auto; padding: 0 20px; line-height: 32px; vertical-align: top; text-transform: uppercase; color: #f00 !important; font-size: 10pt; border-radius: 22px; cursor: pointer; >a.io_button:hover < text-decoration: none; >.io_item .btn_close < display: none; >.io_item .btn_open < display: inline-block; >.io_item.open .btn_close < display: inline-block; >.io_item.open .btn_open < display: none; >.io_trans < width: inherit; position: absolute; height: 80px; bottom: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%); transition: 1s; >.io_item.open .io_trans < height: 0; transition: 1s; >.io_item_wrap < position: relative; overflow: hidden; max-height: 100px; width: inherit; transition: max-height 0.5; >.io_item.open .io_item_wrap

Показать скрыть текст CSS

Подобное скрытие текста можно реализовать одними средствами CSS и HTML. И это не значит какой-то недостаток. В том плане, что будет хуже, чем с помощью JS/jQuery. Да и в целом многое зависит от поставленной задачи. И помните, всегда можно отредактировать стили под свой дизайн сайта.

Первый пример Посмотреть демо

 
текст

CSS

.spoiler_content < opacity: 1; transition: opacity 0.4s ease-in-out; >.spoiler_content p < text-align: left; margin-bottom: 5px; >.read-more-state < display: none; >.text_hide < opacity: 0; max-height: 0; font-size: 0; transition: opacity 0.4s ease-in-out; >.read-more-state:checked~.spoiler_content .text_hide < opacity: 1; font-size: inherit; max-height: 999em; >.read-more-state:checked~.spoiler_content p < margin-bottom: 20px; >.read-more-state~.read-more-trigger:before < content: 'Показать всё'; >.read-more-state:checked~.read-more-trigger:before < content: 'Скрыть текст'; >.read-more-trigger

Второй пример Посмотреть демо

.spoiler_wrap < position: relative; min-height: 30px; margin-bottom: 15px; >.spoiler_title < width: 100%; position: absolute; top: 0; left: 0; margin: 0; height: 30px; z-index: 1; font-weight: 600; font-size: 18px; >.toggle:checked~.spoiler_title, .spoiler_title:hover < color: #EA2816; >.icon < height: 18px; position: absolute; width: 18px; right: 0; top: 11px; z-index: 2; >.icon:before, .icon:after < background: #333; content: ''; height: 4px; right: 0; position: absolute; top: 0; width: 18px; transition: transform 500ms ease; >.toggle:checked~.icon:before, .toggle:checked~.icon:after < background: #EA2816; >.toggle:not(:checked)~.icon:before < transform: rotate(180deg); >.toggle:not(:checked)~.icon:after < transform: rotate(90deg); >.toggle < width: 100%; height: 40px; margin: 0; opacity: 0; cursor: pointer; position: absolute; top: 0; z-index: 3; >.border < height: 40px; border-bottom: 1px solid #333; >.toggle:checked~.border < border-bottom: 1px solid #EA2816; >.spoiler_content < padding: 15px 0 0 0; height: 0; overflow: hidden; z-index: -1; position: relative; opacity: 0; transition: .4s ease; >.toggle:checked~.spoiler_content < height: auto; opacity: 1; z-index: 2; >.spoiler_content>p

HTML-тег details: показать скрыть текст

Есть совсем простое решение, чтобы создать кнопку, при нажатии на которую открывается текст. Для этого существуют специальные теги в HTML 5, такие как , . По сути, их можно использовать даже без стилей CSS. Но чтоб всё сделать красиво, конечно, желательно применить каскадную таблицу.

 
Что такое спойлер?

текст

Открытый спойлер

текст

details < min-height: 5px; padding: 25px 70px 25px 25px; margin: 0 auto; position: relative; font-size: 22px; border: 1px solid #333; border-radius: 10px; box-sizing: border-box; transition: all .3s; >details+details < margin-top: 20px; >details[open] < min-height: 50px; >details[open] summary ~ * < animation: anspl .3s cubic-bezier(.52,.41,.75,.74); >@keyframes anspl < 0% 100% > details p < color: #444; font-weight: 400; margin: 15px 0; >details p:last-child < margin-bottom: 0px; >summary < display: flex; align-items: center; font-weight: 500; cursor: pointer; >summary:focus < outline: none; >summary::-webkit-details-marker < display: none >summary::before < content: '+'; padding-right: 0.5em; >details[open]>summary::before

Читайте также:

Источник

Читайте также:  Php получить хост url
Оцените статью