I have a table that is custom created and have it styled in the .ascx, through CSS. See below:
<style>
.divTable {
display: block;
height: auto;
width: calc(100% - 25%);
font: normal 12px/150% Arial, Helvetica, sans-serif;
overflow: hidden;
text-align: left;
}
.divBody {
position: relative;
height: calc(100% - 42px);
border: 2px solid #000000;
font-size: 12px;
font-weight: normal;
top: 0px;
left: 0px;
right: 0px;
overflow-x: scroll;
overflow-y: scroll;
color: #383838;
width: auto;
height: 500px; -- this is the one I am trying to get to be the custom height; either 500px if on a view tab or auto if on another tab.
}
....
</style>
Now, this is in a custom control called DataGridForDetails. When I bring this in to a 'VIEW' page, then it lists things perfectly, looks great. However, I have a 'DETAILS' sheet that has this control being re-used for other data that may or may not have as many items in the table (i.e the user clicks on a row in the view, takes them to the details page that has 2 of these datagrids that display asset costs and timesheet costs).
I want to be able to re-use this datagrid so that it 'can' be 500px height on the view tabs, however, to be auto height when it's on the other pages.
Is there any way of doing this? I've tried using !important, .style1.style2. Everything short of creating a new control purely for the other pages (maybe this is what needs to be done?).
Cheers.
One suggestion
design your user control as u like with divs and tables
create a seperate css file for view tabs
create a different css file for other pages
and use id selection in css. That is use #div , #Table etc. So it will affect all divs on that page.
Apply css carefully on to respective pages.
I am not sure it's the best way.
So rather than creating a separate CSS style sheet, I modified the original CSS styling and class names, then in the code behind, depending on whether it is a 'VIEW' tab or other tab, I run an if else statement and assign the corresponding class to the grid.
It may not be pretty, but it works.
Hope this helps.
Cheers.
If Request.RawUrl.Contains("VIEW") Then
sb.AppendLine("<div class='divBodyView' id='" & TableName & "'>")
Else
sb.AppendLine("<div class='divBodyOther' id='" & TableName & "'>")
End If
.divBodyView {
position: relative;
border: 2px solid #000000;
font-size: 12px;
font-weight: normal;
top: 0px;
left: 0px;
right: 0px;
overflow-x: scroll;
overflow-y: scroll;
color: #383838;
width: 100%;
height: 100%;
}
.divBodyOther {
position: relative;
border: 2px solid #000000;
font-size: 12px;
font-weight: normal;
top: 0px;
left: 0px;
right: 0px;
overflow-x: scroll;
overflow-y: scroll;
color: #383838;
width: 100%;
height: 100%;
}
Related
I want to update style.css of mywebsite , it is working on most of the part but there is specific issue with search icon. I put related photos to attachment highlated with yellow as you may see I can do it on browser but when I change it on style.css it is not working, coming as older. By the way I changed search box by style.css without any issue. Style.css code are below.
Could you please help on this, is there anything that I miss.
form.search-form [type="submit"] {
border: none;
cursor: pointer;
padding: 0 16px;
line-height: 38px;
height: 65px;
vertical-align: middle;
position: absolute;
top: 0;
right: 0;
}
This mostly occurs when your current css code cannot override the default css code applied on the element by default.
To override the default code, you can simply use !important and add it in front of the css code you want to use.
form.search-form [type="submit"] {
border: none;
cursor: pointer;
padding: 0 16px;
line-height: 38px;
height: 65px !important;
vertical-align: middle;
position: absolute;
top: 0;
right: 0;
}
I want to display a list of email addresses like this:
a#domain1.com
asd#domain1.com
dsasadsd#domain2.com
gg#domain2.com
cc#g.com
hinxterpexterpoxterfinter#e.com
j#foxyfarmfetched.com
So, first sorted by domain, then by account, and all aligned by the # sign. The sorting part is trivial, but how do I get the addresses to line up like that?
I tried making a <table> and putting the parts in different cells, but the result was that when copy-pasting them there was an extra TAB character:
a #domain1.com
asd #domain1.com
dsasadsd #domain2.com
gg #domain2.com
cc #g.com
hinxterpexterpoxterfinter #e.com
j #foxyfarmfetched.com
Not cool. And for bonus points, it would be nice to make each email address a clickable mailto: link as well, which is impossible if the address is split into two cells.
Is there any other way to achieve this effect, or am I out of luck? I'm fairly proficient at HTML/CSS, but in this case nothing comes to mind.
You can try something like below. It should work fine for the copy/paste and the link too:
a {
display:table-row;
}
a span {
display:table-cell;
text-align:right;
}
<span>a#</span>domain1.com
<span>asd#</span>domain1.com
<span>dsasadsd#</span>domain2.com
<span>gg#</span>domain2.com
<span>cc#</span>g.com
<span>hinxterpexterpoxterfinter#</span>e.com
<span>j#</span>foxyfarmfetched.com
You can also achieve by css position property something like below.
Tested copy/paste on Chrome, FF & EDGE working fine also mailto: link as well.
.links{
width: 100%;
max-width: 1000px;
display: block;
margin: 0 auto;
background-color: #f9f9f9;
text-align: center;
padding: 10px;
box-sizing: border-box;
font-family: Arial;
font-size: 15px;
}
a{
display: table;
white-space: nowrap;
text-align: center;
position: relative;
padding: 4px;
margin: 0 auto;
}
a span{
position: absolute;
}
a span:nth-child(1){
right: 50%;
margin-right: 9px;
}
a span:nth-child(2){
left: 50%;
margin-left: 9px;
}
<div class="links">
<span>a</span>#<span>domain1.com</span>
<span>asd</span>#<span>domain1.com</span>
<span>lucknow</span>#<span>domain2.com</span>
<span>gg</span>#<span>domain2.com</span>
<span>cc</span>#<span>lorem.com</span>
<span>loremispsomdolor</span>#<span>test.com</span>
<span>nameofmail</span>#<span>nameofdomain.co.in</span>
<span>good</span>#<span>hello.in</span>
</div>
I am currently working on the CSS-styling of a Warning statement.
This is a icon + a statement in this specific case. The code is as follow:
$sSCP .warning:before {
color: #E40613;
background-color: #fafafa;
font-size: 15px;
margin-left: 0px;
width: auto;
content:"\f071 WARNING"; /* <-- Font icon + statement*/
}
It works all fine, but now my question!
Is there a way to change the static value "WARNING", written behide the content property to a dynamic one? I use translationfiles where all basic var/attr/strings have been translated.
Now it would be great if I can manage a import at var-ID level.
I was actually wondering if css can do this.
cheers,
Frank
Are you using a CSS preprocessor like SASS or LESS?
Because with CSS this isn't possible. You can manipulate content via javascript or print in the variable on the server.
Another suggestion is that you can maybe add a class for each language and then change the content based on the class.
eg:
$sSCP .warning:before {
color: #E40613;
background-color: #fafafa;
font-size: 15px;
margin-left: 0px;
width: auto;
content:"\f071 WARNING"; /* <-- Font icon + statement*/
}
$sSCP .warning.french:before {
color: #E40613;
background-color: #fafafa;
font-size: 15px;
margin-left: 0px;
width: auto;
content:"\f071 ATTENTION"; /* <-- Font icon + statement*/
}
$sSCP .warning.spanish {
color: #E40613;
background-color: #fafafa;
font-size: 15px;
margin-left: 0px;
width: auto;
content:"\f071 ADVERTENCIA"; /* <-- Font icon + statement*/
}
Sorry if the question is not really relevant, I'm french and I don't know the right terms of what I am asking exacly :)
Here is the 'thing' (module?) I've created to create a circle.
.fake-avatar {
width: 70px;
height: 70px;
}
But I want to outline this one without creating this :
.fake-avatar-outline {
width: 72px;
height: 72px;
}
Here is where I use it :
.fake-avatar-outline.rounded.flex-center.b-success.m-auto.bg-pink
.fake-avatar.rounded.flex-center.b-success.text-xl.m-auto.bg-pink-light.icon-star
so the goal is to have only fake-avatar and change manually the size. How is it possible? Should I do something like that :
.fake-avatar.rounded.flex-center.b-success.m-auto.bg-pink(width='72px')
.fake-avatar.rounded.flex-center.b-success.text-xl.m-auto.bg-pink-light.icon-star
Thank you,
Nicolas
If I am understanding this correctly you are looking for a border
.fake-avatar {
width: 70px;
height: 70px;
/* Add this*/
border: 2px solid #FFF; /* color can go here */
/* If you wanted a circle */
border-radius: 50%;
}
EDIT: As stated in the comments, the poster was also looking for a way to change the width of the element without having to change the class in the css file. I said he could use inline-styles.
<div class="fake-avatar" style="width: 72px"></div>
I also noted that setting styles this way is usually frowned upon as it makes css maintenance a nightmare.
Expanding on #DavidLee's answer, here a snippet with running code for both options.
.fake-avatar {
width: 70px;
height: 70px;
border: 2px solid white;
border-radius: 50%;
background-color:blue;
}
.fake-avatar-outline {
width: 70px;
height: 70px;
border: 1px solid red;
border-radius: 50%;
}
<div class="fake-avatar"></div>
<div class="fake-avatar-outline"></div>
I have a box defined that works for most of my site:
.searchBox
{
width: 610px;
height: 170px;
padding: 15px 55px 5px 15px;
background: url('../images/advanced_search_BG.jpg') no-repeat;
margin-top: 10px;
}
But I have one box that needs to be a little bigger; it has to be height: 220px.
I know I could duplicate the above, calling it, say searchBoxLarge, put that on my div tag, and be done. But that's duplicate code that I don't want.
This might be a 'dumb question', but I'm not trained in CSS and looking for assistance...
What is the format to specify the searchBoxLarge with the height: 220px, but without duplicating the entire searchBox entry?
Add searchBoxLarge to the searchBox declaration, and then make a separate declaration for just searchBoxLarge which overwrites the height value.
.searchBox, .searchBoxLarge
{
width: 610px;
height: 170px;
padding: 15px 55px 5px 15px;
background: url('../images/advanced_search_BG.jpg') no-repeat;
margin-top: 10px;
}
.searchBoxLarge
{
height: 220px;
}
There was a good article about doing this on SitePoint http://www.sitepoint.com/first-look-object-oriented-css/
I would suggest you read the responses to the article since there are some drawbacks to doing your CSS like this, and also some benefits.
I agree the name Object Oriented CSS is misleading because there is no true sub-typing
Cheers! Orin