涉及伪类first-child和dropcap的CSS选择器(CSS selector involving pseudo class first-child and dropcap)
我需要格式化HTML,如下所示。 基本上一个报价是可选的 ,我需要dropcap正文段落的第一个字母。
<article> <p class="quote"> <!-- quote is optional --> Genius begins great works; labor alone finishes them.-- Joseph Joubert </p> <p> <!-- "L" is a dropcap --> Life is like a box of chocolates. </p> <p>...</p> <p>...</p> </article>
我的CSS看起来像这样:
article > p:first-child:first-letter { float: left; font-family: Georgia, serif; font-size: 360%; line-height: 0.85em; margin-right: 0.05em; } p.quote { font-weight: bold; }
当引用报价时,它目前不起作用。 AFAIK我不能选择文章的第一个孩子P,这不是课程“报价”。 如果我无法弄清楚这个问题,我会使用jQuery,但现在我正在寻找一种方法来实现CSS。
提前致谢!
I need to format HTML similar to below. Basically a quote is optional, and I need to dropcap the first letter of the body paragraph.
<article> <p class="quote"> <!-- quote is optional --> Genius begins great works; labor alone finishes them.-- Joseph Joubert </p> <p> <!-- "L" is a dropcap --> Life is like a box of chocolates. </p> <p>...</p> <p>...</p> </article>
My CSS looks like this:
article > p:first-child:first-letter { float: left; font-family: Georgia, serif; font-size: 360%; line-height: 0.85em; margin-right: 0.05em; } p.quote { font-weight: bold; }
It doesn't work currently when the quote is introduced. AFAIK I can't select the article's first child P which is not class "quote." I'll use jQuery if I can't figure this out, but for now I'm looking for a way to do it CSS only.
Thanks in advance!
原文:https://stackoverflow.com/questions/5217086
最满意答案
尝试将返回格式设置为结构:
setdbprefs('datareturnformat','structure'); result = fetch(conn,sql_query); result.(name) ans = ...
Try setting the return format to a structure:
setdbprefs('datareturnformat','structure'); result = fetch(conn,sql_query); result.(name) ans = ...
相关问答
更多-
成对的随机数Matlab(Pairs of random numbers Matlab)[2023-05-11]
我可以看到一个简单的3步过程来获得您想要的输出: 生产2*randperm(3) 将值加倍 每个对添加randperm(2)-2 (随机排列的对(-1,0) )。 在代码中: x = randperm(3) y = 2*x([1 1 2 2 3 3]) z = y + ([randperm(2),randperm(2),randperm(2)]-2) 结果 x = 3 1 2 y = 6 6 2 2 4 4 z = 6 5 2 1 3 4 I can see a simple 3 step proces ... -
如何使用矢量化代码从MATLAB中的两个向量生成所有对?(How to generate all pairs from two vectors in MATLAB using vectorised code?)[2023-02-05]
尝试 [p,q] = meshgrid(vec1, vec2); pairs = [p(:) q(:)]; 请参阅MESHGRID文档 。 虽然这并不完全是这个功能,但是如果你眯着眼睛看,那么你所要求的就是它的功能。 Try [p,q] = meshgrid(vec1, vec2); pairs = [p(:) q(:)]; See the MESHGRID documentation. Although this is not exactly what that function is for, bu ... -
这是一种方法: [~, ~, n1] = unique(X(:,1)); [~, ~, n2] = unique(X(:,2)); B = accumarray([n2 n1],1); S = B*B'; 这给出了完整的矩阵: >> S S = 3 2 0 0 2 5 0 0 0 0 1 1 0 0 1 1 要删除可以使用的对角线和下三角形 S = triu(B*B', ...
-
如何在MATLAB中处理函数参数的名称/值对(How to deal with name/value pairs of function arguments in MATLAB)[2022-01-18]
我更喜欢使用结构作为我的选择。 这为您提供了一种简单的方法来存储选项和一种简单的方法来定义它们。 而且,整个事情变得相当紧凑。 function example(varargin) %# define defaults at the beginning of the code so that you do not need to %# scroll way down in case you want to change something or if the help is %# incomplete o ... -
尝试将返回格式设置为结构: setdbprefs('datareturnformat','structure'); result = fetch(conn,sql_query); result.(name) ans = ... Try setting the return format to a structure: setdbprefs('datareturnformat','structure'); result = fetch(conn,sql_query); result.(name) ...
-
让Matlab搜索键/值对的文本文件并替换值(Have Matlab search a textfile of Key/Value pairs and replace the Values)[2022-12-31]
您可以使用fileread读取文件。 使用replaceBetween(str,“B =”,“;”,newValue)替换文件。 然后使用fprintf将其写回文件。 这需要> = R2016b。 You can use fileread to read in the file. Use replaceBetween(str,"B=",";",newValue) to replace the file. Then use fprintf to write it back out to file. This ... -
最好的方法是使用带有addParameters函数的inputParser类。 简而言之,您的代码看起来像: function foo(x,y,z,varargin) p=inputParser; validationFcn=@(x)isa(x,'double')&&(x<5); % just a random example, add anything addParameter(p,'OptionalArg1',defaultvalue, validationFcn); % same for the ...
-
如何在向量中找到所有不等元素的索引对(Matlab)(How to find all index pairs of unequal elements in vector (Matlab))[2023-03-20]
使用bsxfun然后使用两个输出版本的find来获取对。 triu应用于triu的输出, bsxfun考虑两个可能的顺序中的一个。 [ii jj] = find(triu(bsxfun(@ne, V, V.'))); pairs = [ii jj]; Use bsxfun and then the two-ouput version of find to get the pairs. triu is applied to the output of bsxfun to consider only one ... -
对于问题的第一部分:您希望组合n=4元素,一次取k=2 。 有一个功能,即nchoosek : n = 4; %// number of elements k = 2; %// how many to pick in each group result = nchoosek(1:n, k); 对于第二部分:这是生成所有有序对的直接方法: n = 4; x = randi(n); %// uniformly distributed on {1,2,...,n} y = randi(n-1); y = y + ...
-
pairs = [1 2; 4 6; 7 10]; seq = randi(10,1,10000); for i = 1:size(pairs,1) pair = pairs(i,:); res = strfind(seq,pair); if (~isempty(res)) disp('Bad array!'); break; end pair = fliplr(pair); res = strfind(seq,pair) ...