user Posted June 2, 2015 Report Share Posted June 2, 2015 Есть ли свойство,которое обратно important в стилях? Quote Link to comment Share on other sites More sharing options...
0 SelenIT Posted June 3, 2015 Report Share Posted June 3, 2015 Как вариант, можно задать стиль только для тех img, которым атрибуты не проставлены:img:not([width]) { width: ...px;}img:not([height]) { height: ...px;}Ну или наоборот, если проставлены — переопределять на auto, как предложено выше... 2 Quote Link to comment Share on other sites More sharing options...
0 afdw Posted June 2, 2015 Report Share Posted June 2, 2015 А зачем вам? Расскажите подробнее. Quote Link to comment Share on other sites More sharing options...
0 lexxcode Posted June 2, 2015 Report Share Posted June 2, 2015 отменять important, очевидно же Quote Link to comment Share on other sites More sharing options...
0 Vlad Posted June 2, 2015 Report Share Posted June 2, 2015 Такого свойства нет, поэтому придётся использовать каскадирование. Quote Link to comment Share on other sites More sharing options...
0 sigma77 Posted June 2, 2015 Report Share Posted June 2, 2015 Есть ли свойство,которое обратно important в стилях? Вредный совет: другой important )) Quote Link to comment Share on other sites More sharing options...
0 user Posted June 2, 2015 Author Report Share Posted June 2, 2015 А зачем вам? Расскажите подробнее.Чтобы если у элемента есть атрибуты,например:<img src="" width="100" height="25"/>,то свойства,прописанные в стилях,не отменяли бы их. Quote Link to comment Share on other sites More sharing options...
0 afdw Posted June 2, 2015 Report Share Posted June 2, 2015 А зачем вам? Расскажите подробнее.Чтобы если у элемента есть атрибуты,например:<img src="" width="100" height="25"/>,то свойства,прописанные в стилях,не отменяли бы их. 1. min-height/max-height и min-width/max-width2. <img style="width: 100px" height:25px"> Quote Link to comment Share on other sites More sharing options...
0 user Posted June 2, 2015 Author Report Share Posted June 2, 2015 отменять important, очевидно же В том-то и дело,что дело не в important,а в том,чтобы атрибуты имели больший вес. А зачем вам? Расскажите подробнее.Чтобы если у элемента есть атрибуты,например:<img src="" width="100" height="25"/>,то свойства,прописанные в стилях,не отменяли бы их. 1. min-height/max-height и min-width/max-width2. <img style="width: 100px" height:25px"> Первый способ не подходит по определенным причинам,второй я как раз хотел обойти,чтоб меньше вмешиваться в код,так как при этом пришлось бы много переделывать,но вижу,что придется. Quote Link to comment Share on other sites More sharing options...
0 sigma77 Posted June 2, 2015 Report Share Posted June 2, 2015 img { width: auto; height: auto; } Quote Link to comment Share on other sites More sharing options...
0 antonKar Posted June 2, 2015 Report Share Posted June 2, 2015 important можно перебить только другим important с более высоким приоритетом. Так что JS в руки и вперёд в магазины медицинских товаров. Quote Link to comment Share on other sites More sharing options...
0 antonKar Posted June 3, 2015 Report Share Posted June 3, 2015 Ну или наоборот, если проставлены — переопределять на auto, как предложено выше.. А если переопределять на auto, то получится, что надо будет проставлять !important, а в таком случае auto не будет конфликтовать с шириной в атрибуте? 1 Quote Link to comment Share on other sites More sharing options...
0 SelenIT Posted June 3, 2015 Report Share Posted June 3, 2015 Угу, сглупил я что-то, auto действительно атрибуты не учитывает. Тогда только через not()... Quote Link to comment Share on other sites More sharing options...
0 user Posted June 3, 2015 Author Report Share Posted June 3, 2015 Как вариант, можно задать стиль только для тех img, которым атрибуты не проставлены:img:not([width]) { width: ...px;}img:not([height]) { height: ...px;}Вот это именно то,что нужно,давно искал что-то подобное. Quote Link to comment Share on other sites More sharing options...
Question
user
Есть ли свойство,которое обратно important в стилях?
Link to comment
Share on other sites
13 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.